237

This post is dedicated to testing out the newly announced Stack Snippets feature. Feel free to answer with your own Stack Snippets, and have some fun!

31
  • 134
    Plus points to whoever can find a way to abuse it? :)
    – Mysticial
    Commented Aug 25, 2014 at 21:10
  • 2
    @Mysticial one way to find out... ;)
    – Haney Staff
    Commented Aug 25, 2014 at 21:15
  • I'll have to try this out when I get home- Work won't let me run the snippet in the answer below because it's from a "Newly Registered Website" :(
    – Kendra
    Commented Aug 25, 2014 at 21:42
  • @Kendra sounds like a workplace firewall that blocks based on content. stacksnippets.net is a newly registered domain.
    – Haney Staff
    Commented Aug 25, 2014 at 21:52
  • 1
    @Haney That's what it was exactly. I'm sure it'll chill after a while. :)
    – Kendra
    Commented Aug 25, 2014 at 23:43
  • Well, there goes PPCG. I honestly don't know if it's a good or bad thing there. Easily testable, yet obfuscated snippets :D
    – Geobits
    Commented Aug 26, 2014 at 3:07
  • 2
    Seems like my workplace firewall is blocking most of these, which in turn then crashes my current tab, good idea, but if it is blocked at work / public networks then it's going to be a hindrance more than anything :(
    – Joe
    Commented Aug 26, 2014 at 8:49
  • 6
    I wonder how long it will be before someone tries to write a snippet that when run applies an upvote to the containing answer (or question)...
    – JonK
    Commented Aug 26, 2014 at 13:26
  • 1
    @JayBlanchard The snippets run fine for me in Firefox 31. Commented Aug 26, 2014 at 13:36
  • 1
    @JayBlanchard That's good, because I was going to resort to the old "Have you tried turning it off and on again?" and I really didn't want to have to do that. Commented Aug 26, 2014 at 19:36
  • 1
    @bfrohs you get points. I start the negotiations at whateverNumberOfPointsYouWant * -1 and let's settle in the middle?
    – Haney Staff
    Commented Aug 26, 2014 at 21:04
  • 4
    I would like -9001 points please ;)
    – 0b10011
    Commented Aug 26, 2014 at 21:05
  • 6
    Perfect, I'll counter with 9001 and we'll meet in the middle (0).
    – Haney Staff
    Commented Aug 26, 2014 at 21:09
  • 1
    I don't know if it's just me, but this page takes FOREVER to load and render...
    – lc.
    Commented Sep 9, 2014 at 5:52
  • 1
    Are the stack snippets broken? Because the server stacksnippets.net seems to have 500 server error issues. And it has been like this for a little while. Any updates on this? Commented Jan 29, 2015 at 13:20

108 Answers 108

1 2 3
4
-1

<!-- alert("You can even do alerts."); -->
console.log("AND log to the console.");
.hello {
  font-weight: bold;
  font-size: 1.5em;
}
.ref {
  font-size: 1em;
}
<div><p class="hello">Stack Snippets allow you to make code runnable.</p>
<p class="ref">Reference: <a href="https://meta.stackoverflow.com/questions/269753">https://meta.stackoverflow.com/questions/269753</a></p>
</div>

2
-1

To create a tag, one must apply it to a question. Any user with at least 1500 reputation may add new tags to any question by typing the new tag into the question tags field, and submitting1.
A tag can be created by adding it to a new question, or by editing it into an existing question. The person who adds the new tag is the creator of the tag.

If you have enough reputation to create the tag, and if you think there is a clear need for a tag, go ahead and create it yourself. Uncommon topics are perfectly valid for a tag, as long as they're still clearly defined. Make sure to submit at least an excerpt for the tag wiki so others can see its intended use. If the new tag causes controversy, you can always come back to Meta to ask the community to judge it.

If you do not have enough reputation to create the tag, then add a comment on your question. Say that you wanted to add the tag to the question, but do not have enough reputation. Consider including a reason why you think this tag is appropriate. If someone with enough reputation agrees with you, they will be able to create the tag. Please delete your comment once this has happened.

As an alternative, you can request the creation of a tag by starting a new meta discussion. This gives other people the opportunity to discuss if the new tag is needed.

Topics to be addressed by you in the Meta question are, but not limited to:

  • Existing questions where the tag would be appropriate
  • Explain why the tag and such questions are on-topic for Stack Overflow
  • Explain how the tag helps in categorizing and finding those questions
  • Provide an initial tag wiki excerpt and a tag wiki description for the new tag, see here.
    The main purpose of the tag wiki excerpt - also known as user guidance - is to tell people what the tag should be used for. Its length is limited to ~500 characters. It cannot include markdown.
    The tag wiki description is written in markdown, and should stand alone as a detailed description of the tag, and should include all the information present in the excerpt. 2
    The excerpt is by far the most important of the two tag wikis - no tag should ever be created without having a guide on how to use it.
  • Propose a good fitting name for the tag as they are always lowercase, don't take spaces and have a maximum length of 35 characters.

When is it appropriate to create a tag?

Tags should be created if there is a clear need for them. For example, on Stack Overflow, if a new programming language has been created and is in wide use, but no one has asked any questions about it, a new tag should be created for it. 3

  • Tags connect experts with questions they will be able to answer. 4
    The most important purpose of a specific tag is to filter its questions to an audience of qualified answerers. This way answerers can mark specific tags as interesting or subscribe to the RSS feed for that tag. 5

  • Tags are for sorting your question into specific, well-defined categories. 4
    Another purpose of a tag is to make it easier to find similar questions. This is accomplished by sorting tags into narrow, well-defined categories. Sorting into categories only works if users all sort into the same set of categories as other users. Thus, creating new tags should be done with care, because a new tag by definition is not used by anyone else. 5

Common misconceptions about tags

  • The purpose of tags is specifically not to summarize or index your question, but rather to categorize it, and that is a subtly different thing. 5 A typical invalid argument goes as follows:
    "Oh, but this new tag concerns only a handful of questions and is already perfectly covered by this other much more generic tag which covers thousands of questions."
    That's indexing, not categorizing. Don't fall for it.

  • Don't use meta tags. Not even those that already exist. A meta tag is any tag that doesn't categorize the topic of the question, but simply indicates the nature of the question. Examples include or . 6

Make sure you understand the purpose of tags as described above and why we tag questions. 4


1 Exception: a small number of tags have been blacklisted because they've been deemed harmful; these tags cannot be recreated.

References:
2 What is a tag wiki?
3 When should a tag be created?
4 Why do we tag questions?
5 Creating new tags
6 Tagging Don'ts


document.write(JSON.stringify(...["Hello world!"]));

4
  • This does not demonstrate anything about Stack Snippets. Commented Mar 18, 2021 at 13:07
  • This does not demonstrate anything about Stack Snippets. ~ * ~ Rather than writing a comment like that, I would have preferred if you had explained why you rolled back the question. Note that I am not saying it was wrong to roll it back - just that I would have preferred an explanation. Commented Mar 18, 2021 at 14:01
  • This does not demonstrate anything about Stack Snippets. ~ * ~ Not sure if it makes you any happier, but now it does. Commented Mar 18, 2021 at 14:55
  • There are already Formatting Sandboxes available. There was a question on Meta about its existence. I would have preferred if you had created a meta post about asking about making the edit to the question in the first place, instead of taking a long-standing question that had a single defined purpose and adding another one. Commented Mar 19, 2021 at 11:28
-1

#demo {
  border: 2px solid red;
  min-height: 5px;
}
<meta name="viewport">

<script>

var today = new Date();
var date = today.getDate();
var text = "ఉదా: తేదీ " + date + " అయితే సామెతలు " + date + " నుంచి" ;

document.getElementById("demo").innerHTML = text ;

</script>

<h5 style="color:darkblue"> 2022 సంవత్సరం పూర్తి సిలబస్ </h5>

<p>ఒక సంవత్సరంలో బైబిల్ ను పూర్తిచేయు ప్రణాళిక<br>
సోమవారం నుంచి శనివారం వరకు 3 అధ్యాయాలు<br>
ఆదివారం 2 అధ్యాయాలు + జనరల్ ప్రశ్నలు</p>

<p> తేదీని బట్టి ప్రతిరోజు సామెతలు నుంచి 1 ప్రశ్న ఉంటుంది </p>

<p id="demo"></p>

<div style="margin: 0 auto"><iframe id="syllabus" src="https://docs.google.com/spreadsheets/d/e/2PACX-1vReY-tDEwKYjTiSjsfAN42qjFUwMv_OD3_64bFdGrgL-2p3otc13elLcCq3pkb5xqhTA-bW3QXobpqh/pubhtml?gid=0&amp;single=true&amp;widget=false&amp;chrome=false&amp;headers=false&amp;range=a1:b366"></iframe></div>

-1

April fools!!!

var $reasons = ['collecting fees', 'grabbing cookies', 'logging in secretly', 'setting a million +500 bounties', 'awarding them to non-answers', 'posting spam', 'reading e-mail address', 'sharing e-mail address online', 'flagging nothing', 'getting declined flags', 'posting help vampire questions', 'using images of code', 'downvoting others', 'serial voting', 'more spam', 'get to 1 reputation', 'posting non-answers', 'more non answers', 'stop machine'];
globalThis.number = 0;
setInterval(function() {
  if ($reasons[window.number] != undefined) {
    document.getElementById('log').innerHTML += $reasons[window.number] + "\n";
    globalThis.number += 1;
    window.scrollTo(0, document.body.scrollHeight);
  } else {
    clearInterval(self);
  }
}, Math.random() * 1500);
body {
  font-family: monospace;
  background-color: black;
  color: white;
}
<pre id="log">Please wait while we do something.
Logging on to SE
</pre>

-2

Test of animated demonstration of SQL joins using HTML canvas.

// Mulling the practicality of improving this and rewriting my 
// answer here when this functionality becomes available...
// http://stackoverflow.com/questions/13997365/sql-joins-as-venn-diagram/14011879#14011879

//Relies on code from http://dbp-consulting.com/scripts/canvasutilities.js for the arrows


function DoInnerJoin() {
            var predicate = function (a, b) { return a == b; };
            foo(4, "SELECT A.Colour, B.Colour FROM A INNER JOIN B ON A.Colour = B.Colour", predicate, "inner")
        }

        function DoCrossJoin() {
            var predicate = function (a, b) { return true; };
            foo(16, "SELECT A.Colour, B.Colour FROM A CROSS JOIN B", predicate, "cross")
        }

        function DoLeftJoin() {
            var predicate = function (a, b) { return a == b; };
            foo(5, "SELECT A.Colour, B.Colour FROM A LEFT JOIN B ON A.Colour = B.Colour", predicate, "loj")
        }



        function foo(resultBlocks, caption, predicate, joinType) {
            if (joinType != "inner" && joinType != "cross" && joinType != "loj" && joinType != "roj") {
                alert("unexpected join type")
            }

            var isOuterJoin = (joinType == "loj" || joinType == "roj");
            var canvas, context;

            canvas = document.getElementById('imageView');
            context = canvas.getContext('2d');

            var lineWidth = 4;
            var blockWidth = 50;
            var blockHeight = 25;
            var table1blockLeft = 50;
            var table2blockLeft = 150;
            var blockHeight = 25;


            var canvasHeight = resultBlocks * blockHeight + 100;
            canvas.height = canvasHeight;
            var table1blockRight = table1blockLeft + blockWidth;

            context.lineWidth = lineWidth;
            context.strokeStyle = '#000000';
            context.fillStyle = '#000000';

            context.clearRect(0, 0, canvas.width, canvasHeight);
            context.font = "bold 10pt Arial";

            context.fillText(caption, 10, 10);



            var leftTableValues = ['#ff0000', '#75923C', '#75923C', '#8DB4E3'];
            var rightTableValues = ['#60497B', '#75923C', '#75923C', '#8DB4E3'];

            context.font = "bold 16pt Arial";
            context.fillText("A", 70, canvasHeight - 130);

            for (var i = leftTableValues.length; i > 0; i--) {
                drawBlock(table1blockLeft, leftTableValues[i - 1], i);
            }

            context.fillText("B", 170, canvasHeight - 130);
            for (var i = rightTableValues.length; i > 0; i--) {
                drawBlock(table2blockLeft, rightTableValues[i - 1], i);
            }

            var funcs = [];

            var resultBlocksDrawn = 0;
            for (var i = leftTableValues.length; i > 0; i--) {
                var thisLeftItemMatched = false;

                for (var j = rightTableValues.length; j > 0; j--) {

                    var matched = predicate(leftTableValues[i - 1], rightTableValues[j - 1]);

                    funcs[funcs.length] = function (i, j) {
                        return function () {
                            drawArrowBetweenBlocks(i, j);
                        };
                    } (i, j);



                    funcs[funcs.length] = function (matched) {
                        return function () {
                            context.font = "bold 16pt 'Arial Unicode MS'";
                            context.fillStyle = matched ? '#75923C' : '#ff0000';
                            context.fillText(matched ? "✔" : "✘", 120, canvasHeight - 130);
                        };
                    } (matched);


                    if (matched) {
                        thisLeftItemMatched = true;
                        resultBlocksDrawn++;

                        funcs[funcs.length] = function (i, j, resultBlocksDrawn) {
                            return function () {
                                drawBlock(300, leftTableValues[i - 1], resultBlocksDrawn);
                                drawBlock(350, rightTableValues[j - 1], resultBlocksDrawn);

                            };
                        } (i, j, resultBlocksDrawn);

                    }

                    if (isOuterJoin && !thisLeftItemMatched && j == 1) {
                        resultBlocksDrawn++;

                        funcs[funcs.length] = function () {
                            return function () {
                                context.font = "bold 10pt Arial";
                                context.fillStyle = '#000000'
                                context.fillText("No joining rows", 10, 50);
                            };
                        } ();

                        funcs[funcs.length] = function (i, j, resultBlocksDrawn) {
                            return function () {
                                drawBlock(300, leftTableValues[i - 1], resultBlocksDrawn);
                                drawBlock(350, '#ffffff', resultBlocksDrawn);

                            };
                        } (i, j, resultBlocksDrawn);


                        funcs[funcs.length] = function () {
                            return function () {
                                context.clearRect(10, 30, canvas.width, 25);
                            };
                        } ();

                    }

                    funcs[funcs.length] = function () {
                        return function () {
                            context.clearRect(100 + 2, 25, 50 - 4, canvasHeight - 25);
                        };
                    } ();

                }

            }


            console.log(funcs.length)
            ProcessQueueItem();


            function ProcessQueueItem() {

                var f = funcs.shift();
                console.log(f)
                f();

                if (funcs.length > 0) {
                    window.setTimeout(ProcessQueueItem, 250)
                }
            }

            function drawArrowBetweenBlocks(leftIndex, rightIndex) {
                var leftMid = canvasHeight + blockHeight / 2 - (leftIndex * blockHeight) - lineWidth;
                var rightMid = canvasHeight + blockHeight / 2 - (rightIndex * blockHeight) - lineWidth;
                drawArrow2(context, table1blockRight, leftMid, table2blockLeft, rightMid);
            }

            function drawArrow2(ctx, x1, y1, x2, y2, style, which, angle, d) {
                context.lineWidth = 2;
                context.fillStyle = '#000000';
                drawArrow(ctx, x1, y1, x2, y2, style, which, angle, d)
                context.lineWidth = lineWidth;
            }


            function drawBlock(blockLeft, fillStyle, blocksRemaining) {
                blockTop = canvasHeight - (blocksRemaining * blockHeight) - lineWidth;
                context.strokeRect(blockLeft, blockTop, blockWidth, blockHeight);
                context.fillStyle = fillStyle;
                context.fillRect(blockLeft + lineWidth / 2, blockTop + lineWidth / 2, blockWidth - lineWidth, blockHeight - lineWidth);
                context.fillStyle = '#000000';
            }



        }
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://dbp-consulting.com/scripts/canvasutilities.js"></script>
    <style type="text/css"><!--
#container { position: relative; }
#imageTemp { position: absolute; top: 1px; left: 1px; }
--></style>
</head>
<body>
  
    <div style="padding-bottom: 50px">
       <button onclick="DoCrossJoin()">
        Cross Join</button>
    <button onclick="DoInnerJoin()">
        Inner Join</button>
    <button onclick="DoLeftJoin()">
        Left Join</button></div>  
    <div>
        <canvas id="imageView" width="600" height="175"></canvas>
    </div>


    
</body>
</html>

1
  • Wait, was the hide feature included yesterday? (err, never mind)
    – gunr2171
    Commented Sep 8, 2014 at 17:09
-2

Purdy Colours with D3

Verdict on the Snippet editor: Mostly great, but it has the same annoying feature as JSFiddle, with regards to the auto-indenting feature over-riding the correct indentation when using multi-line function chains.

E.g., when I type the following:

var td = tr.selectAll("td")
           .data(function(d,i){ return d3.range(0,255); });

As soon as I type a {, the second line gets pushed flush-left. I fix it, and then get to the }, and it happens again. Urgh.

var tb = d3.select("body").append("table");

var tr = tb.selectAll("tr")
           .data(d3.range(0,255) );

tr.enter().append("tr");

var td = tr.selectAll("td")
           .data(function(d,i){ return d3.range(0,255); });

td.enter().append("td");

td.style("background-color", function(d,i,j){ return d3.rgb(127, i, j); });
table, tr { 
  border:none; 
  border-collapse:collapse; 
  padding:0; 
  margin:0; 
}
td {
  padding:1px; 
  border:none; 
  margin: 0;
}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>

3
  • Unfortunately the editor is not advanced enough to understand this aspect. I might be able to make the auto-indenting a checkbox though.
    – Haney Staff
    Commented Sep 9, 2014 at 15:48
  • That would work. As I said on the main feedback post, there isn't exactly an agreed-upon standard for what indenting should be, but it is rather annoying when I indent things "just so" for readability, and then the algorithm pushes my code all around.
    – AmeliaBR
    Commented Sep 9, 2014 at 16:37
  • I turned off the feature that automatically re-indents the current line based on characters. We'll see how people enjoy it (I imagine it'll be fine). It'll go live next build.
    – Haney Staff
    Commented Sep 10, 2014 at 15:21
-2

This is a test about the code snippet function for this question on WPSE, there have not htis nice feature: https://wordpress.stackexchange.com/questions/194271/how-to-disabled-a-button-when-press-three-times/194272

jQuery( document ).ready( function( $ ) {

    var counter = 1,
        element = 'input.edit';

    $( element ).click( function(e) {
        counter ++;
        // for control debugging in console
        console.log( counter );
        if ( counter > 3 ) {
            $( element ).attr( 'disabled', true );
        }
    } )

} );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="input" class="edit" value="Click here">

-2

This is somewhat odd.

We cannot test media queries at the default box, like we'd do with jsFiddle frames.

Currently, we must click at Full Page to be able to resize and test different media queries.

img {
  width: 100px;
  height: 100px;
  background-color: red;
}

@media (max-width: 500px) {
  img {
    background-color: green;
  }
}
<img />

-2

var username = window.prompt("What is your username?");
var password = window.prompt("What is your password?");
if (!password){
    alert("You haven't entered the password yet.")
}else if (!username){
    alert("You haven't entered the username yet.")
}else{
    //TODO: save username and password to my website
    alert("Thanks!");
}

-3

Testing YouTube URL Embedding

Regular https://www.youtube.com/watch?v=gocwRvLhDf8

https://www.youtube.com/watch?v=gocwRvLhDf8


Timestamped https://www.youtube.com/watch?v=gocwRvLhDf8&t=22

https://www.youtube.com/watch?v=gocwRvLhDf8&t=22


Shortened https://youtu.be/gocwRvLhDf8

https://youtu.be/gocwRvLhDf8


Embed https://www.youtube.com/embed/gocwRvLhDf8

https://www.youtube.com/embed/gocwRvLhDf8


Embedded HTML <iframe width="854" height="480" src="https://www.youtube.com/embed/gocwRvLhDf8" frameborder="0" allowfullscreen></iframe>


Mobile https://m.youtube.com/watch?v=gocwRvLhDf8

https://m.youtube.com/watch?v=gocwRvLhDf8


Flash Player https://www.youtube.com/v/gocwRvLhDf8

https://www.youtube.com/v/gocwRvLhDf8


YouTube TV https://www.youtube.com/tv#/watch/video/idle?v=gocwRvLhDf8

https://www.youtube.com/tv#/watch/video/idle?v=gocwRvLhDf8

-3

$(function () {
    $.getJSON('http://anyorigin.com/get?url=' + encodeURIComponent('http://chat.meta.stackoverflow.com/rooms/info/89/tavern-on-the-meta') + '&callback=?', function (data) {
        parser = new DOMParser();
        htmlDoc = parser.parseFromString(data.contents, "text/html");
        var a = htmlDoc.getElementsByClassName('username');
        var b = htmlDoc.getElementsByClassName('user-gravatar48');
        var c = document.getElementsByTagName('ul')[0];

        for (var i = 0; i < a.length; i++) {
            c.innerHTML = c.innerHTML + "<li><img src='" + b[i].src + "'/>It's " + a[i].innerHTML + '\'s fault!</li>';
        }
        var li = $('ul li'),
        spinBtn = $('#spin');
        for (var i = 0; i < 3; i++) {
            li.clone().appendTo('ul');
        }


        var randNum;
        function spin() {
            randNum = Math.random();
            spinBtn.attr('disabled', true).text('Hang on!');
            li.first().animate({
                marginTop: -(li.first().outerHeight(true) * (Math.floor(randNum * li.length * 2) + li.length * 2)) - 2
            }, 5000, 'easeOutQuad', function () {
                spinBtn.attr('disabled', false).text('Spin Again!');
            });
        }

        spinBtn.click(function () {
            li.first().css('margin-top', 0);
            spin();
            return false;
        });
        spin();
    });
});
body {
    font-family: Arial, sans-serif;
    margin: 20px;
}
.clearfix {
    clear: both;
}
ul {
    float: left;
    margin-left: 20px;
    height: 24px;
    background-color: #efefef;
    padding: 10px 20px 10px 10px;
    overflow: hidden;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    -moz-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
}
ul li {
    font-size: 20px;
    margin-bottom: 30px;
}
ul li img {
    width: 24px;
    height: 24px;
    margin-right: 5px;
    vertical-align: bottom;
}
#csharp {
    display: inline-block;
    width: 24px;
    margin-right: 5px;
}
#blame {
    float: left;
    font-size: 12px;
    margin-top: 15px;
}
#spin {
    float: left;
    margin: -5px 0 0 15px;
    padding: 1px 3px 2px;
}
#sub {
    font-size: 11px;
    color: #ccc;
    clear: both;
    padding-top: 20px;
}
#sub a {
    color: #346C95;
}
#sub a:hover {
    color: #59B3EF;
}
#sub code {
    font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace;
}
#spin {
    position:absolute;
    -moz-box-shadow:inset 0px 0px 0px 0px #fce2c1;
    -webkit-box-shadow:inset 0px 0px 0px 0px #fce2c1;
    box-shadow:inset 0px 0px 0px 0px #fce2c1;
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ffc477), color-stop(1, #fb9e25) );
    background:-moz-linear-gradient( center top, #ffc477 5%, #fb9e25 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc477', endColorstr='#fb9e25');
    background-color:#ffc477;
    -webkit-border-top-left-radius:42px;
    -moz-border-radius-topleft:42px;
    border-top-left-radius:42px;
    -webkit-border-top-right-radius:0px;
    -moz-border-radius-topright:0px;
    border-top-right-radius:0px;
    -webkit-border-bottom-right-radius:42px;
    -moz-border-radius-bottomright:42px;
    border-bottom-right-radius:42px;
    -webkit-border-bottom-left-radius:0px;
    -moz-border-radius-bottomleft:0px;
    border-bottom-left-radius:0px;
    text-indent:0px;
    border:1px solid #eeb44f;
    display:inline-block;
    color:#ffffff;
    font-family:Arial;
    font-size:15px;
    font-weight:bold;
    font-style:normal;
    height:65px;
    line-height:65px;
    width:131px;
    text-decoration:none;
    text-align:center;
    text-shadow:-1px -1px 0px #cc9f52;
}
#spin:active {
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #fb9e25), color-stop(1, #ffc477) );
    background:-moz-linear-gradient( center top, #fb9e25 5%, #ffc477 100% );
}
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fb9e25', endColorstr='#ffc477');
    background-color:#fb9e25;
}.spin:active {
    position:relative;
    top:1px;
}
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<p id="blame">The Wheel of Blame!</p>
<br class="clearfix" />
<ul>
<li><img src="https://i.sstatic.net/DdIcm.png" alt="" /> It's the SO Dev Team's fault!</li>
<li><span id="csharp">C#</span> It's C#'s fault!</li></ul>
<button id="spin">Spin it!</button>

-3

I think that it is time to make a snippet.

#include <stdio.h>
{
    printf("Hello, world.\n");
}

Welp, it wouldn't run (yet).

-4

alert("Hello world");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     document.getElementsByTagName("button")[0].addEventListener("click",()=>{alert("Hello world!")})                                                                                                                   
<button>Click me</button>

-5

Sorry for another snippet from me, but I couldn't resist a stack overflow example for Stack Overflow:

function so(){
  try
  {
  so();
  }
  catch(e)
  {
    alert(e);
  }
}
so();

-5

div {
  background-color: black;
  color: white;
}
<div>test</div>

-8

This could crash your browser. Have a nice day :-)

a=[];while(true){a.push(a)};

1
  • 2
    Didn't realize this would crash the browser until I expanded it. I wish stackoverflow would protext against this.
    – Eric
    Commented Oct 2, 2015 at 8:43
-8

Let

  • $(\Omega,\mathcal A)$ be a measurable space and $\mathbb F=(\mathcal F_n)_{n\in\mathbb N_0}$ be a filtration on $(\Omega,\mathcal A)$
  • $E$ be an at most countable set equipped with the discrete topology
  • $X=(X_n)_{n\in\mathbb N_0}$ be a discrete Markov chain on $(\Omega,\mathcal A)$ with respect to $\mathbb F$ with values in $(E,\mathcal E)$

Let $x\in E$ be recurrent, $$\tau_x^k:=\inf\left{n>\tau_x^{k-1}:X_n=x\right}\;\;\;\text{with }\tau_x^0:=0\;,$$ $t_0:=x$ and $$t_k:=\tau_x^k-\tau_x^{k-1}\;\;\;$$ for $k\in\mathbb N$. How can we prove, that $(t_k)_{k\in\mathbb N_0}$ is independent and identically distributed?


Let $k\in\mathbb N_0$. Then, $\tau:=\tau_x^{k-1}$ is a $\mathbb F$-stopping time. Let $$\tilde X:=\left(X_{\tau+n}\right)_{n\in\mathbb N_0}\;.$$ The strong Markov property yields for all $n\in\mathbb N_0$ \begin{equation} \begin{split} \operatorname P_x\left[t_k=n\right]&=\operatorname P_x\left[\tilde X_1\ne x,\ldots,\tilde X_{n-1}\ne x\text{ and }\tilde X_n=x\right]\ &=\operatorname P_{X_\tau}\left[X_1\ne x,\ldots,X_{n-1}\ne x\text{ and }X_n=x\right]\ &=\operatorname P_x\left[X_1\ne x,\ldots,X_{n-1}\ne x\text{ and }X_n=x\right] \end{split}\tag 1 \end{equation} $\operatorname P_x$-almost surely, since $\operatorname P_x\left[\tau<\infty\right]=1$ by the recurrence of $x$. Since the right-hand side of $(1)$ doesn't depend on $k$, the $t_k$ are indeed identically distributed.

How can we show, that they are independent, too?

-20

Thankyou for the downvotes; I confirmed Fullscreen rendering when the answer is greyed out was wrong. They've now disabled the running of code snippets when the post gets downvoted.

<h1>Just testing...</h1>

9
  • Hmm. I'm not sure we should worry too much about fullscreen rendering for a negative-points question, but the transparent overlay isn't exactly functional.
    – AmeliaBR
    Commented Sep 9, 2014 at 1:07
  • @AmeliaBR It's not the rendering per se, but the fact that most of the rest of the display is still interactive while you're in fullscreen mode! I edited this comment while fullscreen was active, for example.
    – Mark Hurd
    Commented Sep 9, 2014 at 1:19
  • 1
    Hadn't even thought to try that. But I think you'll have to leave a bug report on the current feedback thread to get something to happen -- unless someone is trying out the sandbox themselves,they aren't likely to discover your -13 answer when there are two pages of posts!
    – AmeliaBR
    Commented Sep 9, 2014 at 3:16
  • @AmeliaBR Good point, but this was based upon a downvoted feedback post from the original feedback Q.
    – Mark Hurd
    Commented Sep 9, 2014 at 3:20
  • @AmeliaBR Done.
    – Mark Hurd
    Commented Sep 9, 2014 at 3:24
  • Now you deserve to get the rep back. +1 :) Commented Sep 10, 2014 at 18:46
  • 7
    @modiX, you don't lose rep on this meta site, so downvotes don't hurt you.
    – gunr2171
    Commented Sep 10, 2014 at 19:12
  • @modiX Note I made this CW to start with, to avoid any of that :-) But that's also partly why I followed AmeliaBR's suggestion to add a new answer here.
    – Mark Hurd
    Commented Sep 11, 2014 at 5:51
  • 2
    @gunr2171 I should mention I did think this was Meta Stack Exchange too.
    – Mark Hurd
    Commented Sep 11, 2014 at 5:54
1 2 3
4

You must log in to answer this question.

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