I've created answers that contain a runnable code snippet to provide a convenient method for readers to view a demo of my answer's solution. For instance:
In my opinion, this answer:
- highlights solution in first few lines
- provides code snippet to run and view solution in context
- collapses code snippet for readability to allow focus on solution above
However, a more experienced user edited out the snippet without a revision comment, leaving the code expanded. Given that this has happened on a few of my posts (incidentally edited by the same user), I'm starting to think that code snippets might be frowned upon, so I'm interested in clarification on when to use/avoid them. Thoughts?
iron-flex-layout/iron-flex-layout-classes.html
laying around to be imported? If not, it shouldn't be a snippet -- snippets are for live, working code samples.iron-flex-layout-classes.html
.base
tag would allow the import to actually work. Naively, it looks like an example that would only work in a properly-set-up environment. But code that actually runs? Yep, valid snippet.hide: true
but don't run properly? Given that the default is to show the code, and you have to either edit the source or click the "hide by default" checkbox, that seems odd. Hopefully the fact that the author went to the trouble of quoting the important code separately, combined with the snippet being set to hidden by default is a good sign that the author is using snippets correctly.