29

Just saw that StackOverflow and a few other sites have gotten a new runnable code snippets feature.

As far as I can tell it is not enabled for this site -- the toolbar button to access it does not appear:

Stack Snippets button

I think it would be great to have this enabled on our site as well, since we have so many web development questions.

What say you?

9
  • 5
    A good example is here stackoverflow.com/questions/25879439/… 'run snippet'
    – Mapperz Mod
    Commented Sep 18, 2014 at 0:50
  • 3
    Lots more examples here as well: meta.stackexchange.com/questions/239456/…
    – blah238
    Commented Sep 18, 2014 at 0:52
  • 8
    sent an email (to the Stack Exchange Team) requesting it for this site
    – Mapperz Mod
    Commented Sep 18, 2014 at 1:06
  • 3
    This is a brand new feature, but I'm not entirely sure what the plans are for making this available to other sites. But I did forward this on to the dev team to be sure they know about your interest. I cannot promise immediate results, but I'll be sure it is on their radar as we learn more about how this feature works with a site in actual practice. Commented Sep 18, 2014 at 22:15
  • 1
    Robert thanks for the fast and positive feedback we (The GIS SE community) look forward to the dev team potentially implementing this useful tool on GIS SE and other SE sites.
    – Mapperz Mod
    Commented Sep 19, 2014 at 2:34
  • That is pretty cool. I look forward to that on here too. I wonder what programming languages it is limited to. Is it js and web code only? I know python runs on web servers too, but I'm not sure what that output would look like or what the security issues would be. Can we get the arcpy library? just kidding (but not really). Commented Sep 24, 2014 at 17:57
  • 3
    @jbchurchill JavaScript, CSS and HTML only, for now. Beyond that, there are obvious licensing issues around arcpy. However, there are a lot of ArcGIS JavaScript API questions that could benefit from this.
    – blah238
    Commented Sep 24, 2014 at 18:46
  • StackOverflow is proposing changes to the editor. I don't know whether they would make it more or less helpful here. Commented Jul 14, 2015 at 13:36
  • 1
    5 years later - still no news?
    – MrXsquared
    Commented Sep 7, 2019 at 14:39

2 Answers 2

6

This request came up again in the site design announcement which made us realize we never responded publicly about this. Sorry about that!

I think it wasn't totally obvious from the initial release that snippets are really only for JS/HTML/CSS code (a replacement for jsfiddle.net, basically). A good indicator of whether they'll be useful on a site is the number of answers with javascript in them, and especially posts linking to jsfiddle.

GIS I think is probably borderline for this, though you all are much more familiar with your community than I am. There aren't many questions referencing jsfiddle and the javascript tag also seems relatively small. I think we're looking at <3% of posts that could benefit from this (vs, say, Stack Overflow where it's more like 10%).

It's pretty easy for us to turn on (just flip a site setting) so the main question is not dev time but whether it's good for the community. Turning it on does come with some community cost as users get confused about the new button and occasionally mis-use it leading to weird broken code which needs to be cleaned up.

I'm leaning towards "probably not a good fit for this community", but if you all disagree let me know via a comment here.

7
  • 1
    Note that there are a substantial number (~1000) of questions tagged arcgis-javascript-api but not javascript -- not all of these are code questions but I'd guess around half of them are. They just aren't tagged javascript for whatever reason. So that probably brings us up to around 5%. Since we're not a programming-only site like StackOverflow, I think it's to be expected that this feature isn't going to be used as much as it is over there, but I think there is enough that it is worth enabling.
    – blah238
    Commented Jul 7, 2015 at 20:42
  • 1
    There is a similar trend with other APIs e.g. leaflet (~700) and google-maps-api (~250). Many of these have answers with links to external demos.
    – blah238
    Commented Jul 7, 2015 at 20:55
  • 1
    I do more Py than JS, so I may have some bias, but I imagine the vast majority of users here would be confused by that button and use it for Python. The snippets are cool, but my gut says there will be more edit/corrections to posts than people who'd properly use it.
    – KHibma
    Commented Jul 8, 2015 at 13:56
  • Note that it is technically possible to run Python in JavaScript via a JavaScript-based Python interpreter such as Skulpt. The obvious limitations being that it can't do anything outside the browser environment, so no installed packages, reading/writing files, etc. (except perhaps through HTML5 features like LocalStorage). Also highly dependent on the implementation as to what standard Python libraries are supported, if any. The user experience is probably not great since you'd need to have some JavaScript and HTML boilerplate to get it set up, but it is an option.
    – blah238
    Commented Jul 8, 2015 at 19:14
  • For Python gis.stackexchange.com/questions/tagged/python it would be popular on GIS-SE. (97 GIS SE pages of results)
    – Mapperz Mod
    Commented Jul 15, 2015 at 14:25
  • @Mapperz Not sure I understand: do you mean the python-via-javascript package mentioned above? Python won't work with snippets natively anytime in the near future. Commented Jul 15, 2015 at 18:21
  • 1
    A year later and still no progress on this. StackExchange asked for the community whether this would be helpful but ignored our response. Not having code snippets within gis_stackexchange will just force people to post on stackoverflow instead. Please note that the GIS community is transitioning towards a cloud environment with many of the fastest growing tags benefiting from HTML/JS/CSS code snippets. OpenLayers (2987), Javascript (1720), Leaflet (1423), CartoDB (1016), Google-Maps (990), MapBox (338). It is unlikely that the trend will go back to desktop. Commented Jun 9, 2016 at 11:31
3

Happy to share that Stack Snippets is now enabled! We are a tad bit late; ten years is only a little late, right? We found this request after we did an audit of old status tags across the network.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .