Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [stack-snippets]

Stack Snippets are runnable inline code samples. Currently HTML, CSS, and JavaScript are supported. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.

2
votes
0answers
24 views

Allow the stack snippets console to be maximized

Consider the following stack snippet: // A Tree(a) is one of: // - null // - tree(a, Tree(a), Tree(a)) const tree = (value, left, right) => ({ value, left, right }); const buildTree =...
4
votes
0answers
34 views

Increase min-height on SE code snippets to prevent scrollbar from blocking code [duplicate]

When using Stack Exchange/Stack Overflow, anytime there's a one-line code snippet with a horizontal scrollbar, the majority of the code becomes covered. I am using Chrome v72.0.3626.109. Looks ...
2
votes
0answers
22 views

Edits to a post to provide a snippet, but the snippet doesn't work

I found an edit to a post of mine on the 4th Feb this year. To be honest, there wasn't anything wrong with the post (other than a cheeky response/salutation, which I've now removed), but the user ...
-14
votes
0answers
92 views

Should Stack Exchange start using the Zero Clause BSD license for code snippets?

The Zero Clause BSD license was originally from Rob Landley's Toybox project and was added to choosealicense.com yesterday. It seems the ideal license for sharing code snippets given it drops the ...
3
votes
0answers
25 views

Vertical scroll bar overlaps top static bar

In attached image, Vertical scrollbar just overlaps when code snippets is too big and am scrolling up on code snippet area that time vertical scroll will overlap to top static bar.
1
vote
0answers
28 views

Broken view after expanding a snippet

Find a post with Stack Snippet (HTML/CSS/JavaScript) and go for "Expand snippet", for example this one. I got this strange view on Chrome 70 (Windows 10):
4
votes
0answers
43 views

Why don't code snippets work in Tag Wikis?

I noticed code snippets don't work in tag wikis. E.g. https://stackoverflow.com/tags/css/info My reasoning for asking: In most front end tags there will be examples of the relevant code. Snippets ...
2
votes
1answer
37 views

How can I provide a utility on sites without Stack Snippets in an appropriate manner?

I just wrote this answer and in the last paragraph I decided to create a small utility as part of the answer. The utility is needed for the process. After submitting, I found that Android Enthusiasts ...
2
votes
1answer
85 views

Can not create Stack Snippet with YouTube API

When writing How to remove event listener on Youtube player?, I tried to create a Stack Snippet but I could not add the YouTube API client, which was needed to display the issue. The client is on ...
1
vote
0answers
30 views

Does code snippet support CSS modules?

I want to ask a question related to CSS modules (https://github.com/css-modules). Is it possible to use CSS module syntax in a snippet? Such as @value? If yes, how can I enable it?
2
votes
2answers
161 views

Embedding code sandbox

Is it possible to embed codesandbox preview in Stack Overflow? I have tried iframe, embed URL and links but none of it works.
3
votes
1answer
65 views

Creative Commons Attribution-Share Alike and licences information on delivery

is it sufficient to add the Creative Commons Attribution-Share Alike Attributions inside the source code or should it be also added inside a separate licensing file on delivery. E.g. I create a ...
4
votes
0answers
50 views

Stack Snippet console bug

I have encountered a bug in the Stack Overflow snippet interface. I have created a div and wrote some css in the CSS section for the same. I noticed that the div CSS content is affecting the console ...
2
votes
0answers
26 views

Snippet editor for touch devices can be opened if you show perseverance

Opening a code snippet editor via the button from the toolbar cannot be used on touch screen devices like my iPad, i.e. I see the following notice: But occasionally tapping code snippet button ...
13
votes
0answers
94 views

Add detailed help for Stack Snippets to the editor's “Code” section and the advanced help

Stack Snippets are markedly under-documented. Please update the "Code" section of the help you get when you click the (?) icon in the editor, as well as the advanced help, to provide detailed ...
5
votes
2answers
64 views

Is it new stack snippets feature: show few snippets in one scrollable block? [duplicate]

If snippets code have four spaces from start line, then in preview shown just And in finish view snippets shown in one scrollable block (function(){ // some code // some code /...
2
votes
0answers
39 views

How to add multiple HTML pages to code snippets on Stack Overflow [closed]

How do you add multiple HTML pages to code snippets on Stack Overflow? If your code is interlinked with multiple HTML pages, then how do you add multiple pages in code snippets on Stack Overflow?
2
votes
0answers
29 views

Console on snippet going behind contents

I was googling for a code and I reached this Stack Overflow page. Owl Carousel on change not working I tried running the code in answer and it will log something in console in every slide change. ...
2
votes
0answers
29 views

Is the behaviour of code snippets correct, when doing a review task?

I was reviewing a post, and it looked to me that it had an obvious error in its code-- but it had a Code Snippet button, so I decided to click it to make sure this obvious error was there. Sure ...
5
votes
0answers
28 views

Prompt for confirmation when navigating away from stack snippet

In the following specific case: Click 'Ask Question' Click the stack snippet button without entering any other text or question titles or anything in the editor first. When you navigate away from ...
3
votes
1answer
42 views

While undeleting deleted answer, the snippet seems missing

Yesterday I made an answer to this question Why does width and height affect how a flex item is rendered?. I got some downvotes and so I decided to check am I missed something. I temporarily deleted ...
15
votes
0answers
265 views

SCSS, Sass and other CSS preprocessor support for code snippets

Add a possibility to run SCSS, Sass and other CSS preprocessors (LESS, Stylus, PostCSS, maybe others) in code snippets. Many developers use CSS preprocessors. This will remove need to convert demos to ...
2
votes
0answers
53 views

Add allow-same-origin to the Stack Snippet sandox in order to be able to run Geolocation API

Related support question: ERROR(1): User denied Geolocation Please add allow-same-origin to the Stack Snippet sandbox in order to be able to use the Geolocation API. As example, the following code ...
5
votes
1answer
1k views

ERROR(1): User denied Geolocation

While I was researching in order to answer a question on Stack Oveflow en español, I decided to try the code on https://developer.mozilla.org/docs/Web/API/Geolocation/getCurrentPosition1. But I got ...
8
votes
0answers
72 views

Code snippet comments in code formatting break the formatting of the post

When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
-3
votes
1answer
62 views

Code snippets numbering lines with Number Anchors

This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and ...
3
votes
0answers
18 views

Repeating Run Code Snippet row when other answer gets reloaded

In a nutshell, this is the problem: You have an answer with a code snippet. There's another answer that just got updated. You see the "an edit has..." message and click on it. The moment, the other ...
4
votes
0answers
74 views

Can't run Stack code Snippets on the mobile site

Is it a known issue that stack snippets don't have the "Run code snippet" button underneath on the mobile version of the site? Searching for this yielded nothing, both on MSE and MSO. I've posted a ...
11
votes
1answer
116 views

New code snippet causes error on submit?

StackOverflow's editor seem to have changed, or to be more precise, the settings for the snippet editor that allow to run code in questions/answers have changed. The snippets are now executed in a ...
4
votes
1answer
164 views

Do Stack Exchange sites allow to include copyright/license in code snippets?

Suppose we see an answer with a code snippet like this: // Copyright (c) 2017, <some guy's name and email> // // Permission to use, copy, modify, and/or distribute this software for any // ...
2
votes
0answers
34 views

Folding Sections in Answers [duplicate]

We already have the spoiler formatting for information that should be hidden until specifically needed (by hovering), and the code snippet formatting like this for code that can be ...
5
votes
1answer
159 views

Why is there a script error in all Stack Snippets?

I am not sure whether this has been asked before or not, or if anyone else has this problem. I get this "script error" everytime I execute any script in the code snippet tool of Stack Overflow. I have ...
3
votes
0answers
33 views

Make Ctrl+Enter a shortcut for running a Stack Snippet

It would be nice if pressing Ctrl + Enter when editing a Stack Snippet would run it.
1
vote
0answers
142 views

Dojo Toolkit (Dijit) example does not work in Stack Snippet

This snippet is adapted from http://dojotoolkit.org/documentation/tutorials/1.10/dojo_data/demo/store-adapter.html. The snippet works in FireFox, but Chrome gives a browser error: Uncaught ...
1
vote
0answers
33 views

Snack snippets sandbox makes Chrome web browser unresponsive

The sandbox linked to in the [snack-snippets] tag wiki makes my browser sluggish/unresponsive. My CPU usage jumps to 25%, so I think there are either too many snippets, or some of them require too ...
-4
votes
1answer
145 views

How I can add my PHP code in to code snippet?

When I asked a question on Stack Overflow the other users replied me to add a live demo. But my code contains a PHP part also, and I can't see a method to add codes other than HTML, CSS and JavaScript ...
16
votes
0answers
113 views

Deploy updated snippet script and implement a UI for the Stack Snippet console options

Back in May 2016 @canon implemented several useful options in the Stack Snippets console script (there's a demo here). Please Deploy the updated script so those options can be used (currently, only ...
2
votes
0answers
100 views

Code snippet editor is not loading in Chrome!

I don't know whether this is a bug or security issue with chrome. But I'm getting a screen like this when I click on the snippet button. Any help would be helpful. Chrome Console This is what I'm ...
6
votes
1answer
58 views

Typo in Stack Snippets: “Javascript” should be “JavaScript”

That's not a pluralization bug, so I shouldn't expect Jeff coming to my house with a giant "S", right?
2
votes
0answers
278 views

Snippet console.log() return different value than browser console

Not sure why the console.log() in my snippet return different value of the browser developer console : You could see that it return an empty array [] instead of filled one like console below. The ...
4
votes
0answers
53 views

Add support for Stack Snippets on the iOS app

When I view a post including a Stack Snippet, there is no ability to "run" the snippet like on the website. On the app: On the mobile site:
3
votes
0answers
40 views

Bug in Tidy in Snippet

In simple words, when there's a code like this: <img src="http://127.0.0.1/wp/wp-content/uploads/2016/06/PreviousArrowsLikeACatPagenJewelryPentagramsSilverWiccanNecklaceBracelet.png" alt="...
15
votes
9answers
266 views

Stack Snippets Upgrade: new UI

Good news for those who love Stack Snippets (and also for those who don't, but use it anyway). We improved the user experience and UI to: Create visual hierarchy (AKA "easy to use") in the editor ...
6
votes
1answer
55 views

Snippet body is partially clipped/obscured in the snippet editor [closed]

Stack Snippets on SO apparently got some CSS changes (at least), which unfortunately cause part of the snippet body to be clipped/obscured in the snippet editor, at least on Chrome (v51.0.2704.79 on ...
4
votes
1answer
80 views

Define custom console logging for all Node objects

Currently, the virtual console defines a custom logging for HTMLElement objects, e.g. console.log(document.body); However, not all Element objects are HTMLElement, e.g. console.log(...
3
votes
0answers
38 views

The console should not display inherited properties

Currently, when you log an object to the virtual console, it shows all enumerable properties, both own and inherited. I think the inherited ones should be filtered out. Otherwise, the result can be ...
2
votes
1answer
214 views

Stop iterating objects using __proto__

http://stacksnippets.net/scripts/snippet-javascript-console.js uses this function function getProps(obj) { var props = []; do { for (var prop in obj) { if (props.indexOf(...
61
votes
12answers
878 views

Stack Snippets Upgrade: Virtual Console

It's been a long time since we worked on Stack Snippets. I'm sorry. It's mostly because I created it, then I got promoted to management, and now I don't code much anymore and nobody else has time to ...
3
votes
1answer
209 views

NoScript XSS protection for code snippets

The feature: The text editor allows code snippets to be submitted as a sandbox like JSFiddle. I'm referring to the button that reads: JavaScript/HTML/CSS snippet Ctrl-M ...rather than: Code ...
-3
votes
1answer
65 views

Remove Stack Snippets on Meta Stackexchange

Stack snippets are available on this meta.stackexchange.com site, but as mentioned in the initial meta post about them there was no discussion as to whether they should be here or not. I would ...