550
votes
Stack Snippets Sandbox - Try It Out Here!
Detecting and Requiring Upvotes to View the Result
I'm not totally sure this will work...SE caches the API requests, so I can only update it every minute (I think). I can't test it extensively because ...
Community wiki
328
votes
Feedback requested: Runnable code snippets in questions and answers
feature-request status-completed
Provide a button that allows us to "fork" a snippet into an answer, with highlighting of differences between the original and the "forked" version.
This will make it ...
266
votes
Accepted
I've been told to create a "runnable" example with "Stack Snippets". How do I do that?
Stack Snippets are an on-site tool similar to https://jsfiddle.net or https://codepen.io or https://plnkr.co. They're more limited than those tools, but they have the advantage of being on-site, so ...
Community wiki
209
votes
Accepted
How do I create a React Stack Snippet with JSX support?
Here's a step-by-step guide, first summary, then details with pictures. There are a couple of live demonstration snippets after the detailed instructions.
Summary:
Open the Stack Snippets editor by ...
Community wiki
204
votes
Stack Snippets Sandbox - Try It Out Here!
Huh? Not much love for CSS in the current answers? So I would share mine... designed specially for testing this feature... :)
Also on CodePen
Conclusion : It will be great if we can use Auto ...
Community wiki
179
votes
Stack Snippets Sandbox - Try It Out Here!
Let's do a little dungeon crawling! (canvas/keyboard test)
/* set up ROT library */
ROT.DEFAULT_WIDTH = 80;
ROT.DEFAULT_HEIGHT = 16;
var display = new ROT.Display({fontSize: 12});
document....
Community wiki
153
votes
Feedback requested: Runnable code snippets in questions and answers
In the javascript tag, we get comments like these all the time:
JSFiddle please
It would be better if we had a JSFiddle
I can help you if you give me a JSFiddle
We outsource a lot of content to ...
143
votes
Feedback Requested: Code Editor and Stack Snippets
Usually I paste the code from my IDE where it's already correctly indented and formatted :).
In the rare cases where there aren't four leading spaces on the code lines (e.g. I've copied the code from ...

ChrisFMod
- 131k
98
votes
Feedback requested: Runnable code snippets in questions and answers
This is an awesome idea. It would be even more awesome if you supported additional languages.
This seems like a really cool idea, but I'm starting to doubt its value.
Sometimes the fiddle requires ...
88
votes
Accepted
How can we discuss malicious code?
Honestly, I'm of the opinion that we should post exploit code. BUT I think there are certain guidelines to how we post exploit code:
It should be very clearly marked as exploit code (mark it in bold)....
77
votes
Stack Snippets Sandbox - Try It Out Here!
Yet another s***ty Stack Overflow clone (WIP, feel free to contribute).
Features:
You can ask questions (duh)
You still cannot post answers
Mixed spaces and tabs all rejoice
Industry-standard jQuery ...
Community wiki
70
votes
Accepted
Should questions with unnecessary Stack Snippets be edited?
Edit them
The snippet feature is of no use to posts where the code isn't meant to run. It only wastes space.
I usually also add a comment along the lines of:
"Please don't use Stack Snippets for ...
69
votes
Accepted
"JavaScript snippet"? But I use it for HTML and CSS as well!
My suggestion:
Live demo (HTML/CSS/JS only)
It makes clear what languages are supported, and is a clear indication that this is not just a "code snippet" or "code block" feature but an actual ...
68
votes
Stack Snippets Sandbox - Try It Out Here!
Users don't always notice the horizontal scrollbar on code snippets, and it's even harder to notice when the good code obviously scrolls, but not as much as the scrollbar indicates. This can lead to ...
Community wiki
66
votes
Stack Snippets being misused
There are probably things we can do to improve the guidance here, and I expect they'll become more obvious as more people find and use it. We're open to all suggestions.
That said... This isn't the ...
58
votes
Stack Snippets Sandbox - Try It Out Here!
What time is it?
document.getElementsByTagName("div")[0].style.marginTop = document.height / 3 + "px";
window.setInterval(function () {
var time = "";
var now = new Date();
var ...
Community wiki
57
votes
Feedback Requested: Code Editor and Stack Snippets
As ChrisF♦ answered, as long as nothing changes when code is selected and I then press the button, I doubt there's anyone whose current workflow is interrupted by your change.
At least I doubt there's ...
52
votes
Stack Snippets Sandbox - Try It Out Here!
Run the snippet to crash your browser.
var s=' ';while(1)s+=' ';
Community wiki
47
votes
Feedback requested: Runnable code snippets in questions and answers
Limiting this to JS/CSS/HTML seems a bit restrictive. The usual coliru-style online compiler offers many language implementations.
Also, I just saw,
Answers could then be in the form of a Stack ...
46
votes
Stack Snippets Sandbox - Try It Out Here!
Things that currently are nicely sandboxed (feel free to add things you tried that didn't work):
var TESTS = {
"Trashing the parent": function() {
parent.document.querySelector("body")....
Community wiki
46
votes
Stack-Snippets vs PasteBin, jsFiddle, and JSbin
Always prefer hosting the content on SO.
Thus, prefer having your pictures on SE's imgur-account, thus ensuring they will stay available as long as the SE network exists, instead of using any other ...
46
votes
Accepted
Some posts with snippets do not have a run button - Why?
After some digging, this is not a bug. The Stack Snippet is explicitly disabled when the post reaches a score of -3 or lower (i.e. when the post is greyed out), which is the case here.
Quoting Haney ...
45
votes
Should "Run Snippet" option have a reputation requirement? (To prevent... user stupidity and SE as an attack vector)
I think the problem is not in the snippets but with the owner of the router.
If your router can be hacked by a stack snippet, it can also be hacked by a malicious banner ad or by any website for ...
44
votes
Stack Snippets Sandbox - Try It Out Here!
Interesting to see how d3.js and SVG work...
I borrowed the code from a d3 tutorial to test:
http://bl.ocks.org/mbostock/1125997
var margin = {top: 40, right: 40, bottom: 40, left: 40},
...
Community wiki
43
votes
Accepted
Is this 'Run code snippet' with payload an attempt to infect SO users' machines with a virus?
At the moment, Stack Snippets are, to the best knowledge of experts who've considered the problem (both SE employees and standard users like ourselves), completely sandboxed and pretty safe to run. ...
41
votes
Feedback requested: Runnable code snippets in questions and answers
Oh, and here are some items that you are probably already aware of:
There should be a way to close the snippet when done.
It should not 'break silently' just because you don't use semicolons.
The ...
41
votes
Stack Snippets Sandbox - Try It Out Here!
SPAM ME ! Recurse test (Uncaught RangeError: Maximum call stack size exceeded )
NOTE: (IE 8/9 doesn't support console.log on normal window), try this with your dev tools open
IMP: Try it an window ...
Community wiki
40
votes
Accepted
Stack Overflow reputation and profile link in email sign
You could use Flair.
Navigate to your profile -> "Edit Profile and Settings" -> Flair (under the Site Settings subheader). There you'll find an HTML snippet for a generated image with contains your ...
39
votes
Stack Snippets and non-runnable code
If it's not a stack snippet (HTML+CSS+JS), don't use the stack snippet feature.
Copying a bog-standard code-sample to the answer is easy enough, the copy-to-answer button is not valuable enough to ...
37
votes
Accepted
For how long are we allowed to use sandboxes for new features?
It's a sandbox. Play in it.
There's no sense in yelling at people that play in it, regardless of when it was put there.
To that point, Stack Snippets don't support PHP, and the hope/intent is that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
stack-snippets × 447bug × 183
feature-request × 148
discussion × 99
support × 77
status-completed × 45
design × 23
code-formatting × 17
editor × 17
edits × 14
suggested-edits × 10
code × 10
status-bydesign × 9
google-chrome × 8
jsfiddle × 8
user-experience × 7
documentation × 6
asking-questions × 6
user-interface × 6
markdown × 6
help-center × 6
answers × 5
markdown-rendering × 5
review × 4
status-declined × 4