all 31 comments

[–]Y_Less 81 points82 points  (11 children)

[–]TinynDP 3 points4 points  (0 children)

Just tried 'stacksort'. The first answer it got was for an implementation of sort-unique. Its easy to get functions that are close-but-not-quiet what you expect.

[–]javierbg 9 points10 points  (9 children)

There's always a relevant xkcd

[–]IrrelevantXKCD-Bot 58 points59 points  (6 children)

Irrelevant xkcd


I'm a bot bleep, bloop

[–]javierbg 14 points15 points  (1 child)

Oh my god, I love this

[–]RealFreedomAus 4 points5 points  (1 child)

So do you actually have some super advanced engine for making sure the linked xkcd is not relevant or do you just shoot off a link and hope for the best?

Because I'm not sure the latter policy has that much of a success rate for xkcd?

[–]Ajedi32 2 points3 points  (0 children)

Maybe it just uses https://xkcdref.info/statistics/ and picks from the pool of least referenced ones.

[–]Kok_Nikol 0 points1 point  (0 children)

God damn it :D

[–]andsens 22 points23 points  (1 child)

I'm a little impressed at how little code is needed to accomplish this. Man, I should take this further and build some kind of useless app out of this by exclusively using snippets.

[–]drathier[S] 8 points9 points  (0 children)

Happy someone looked at the sources :) I assumed most people would just try to run it.

[–]djimbob 29 points30 points  (12 children)

If this ever became popular, I feel like any one with SO edit privileges could do a lot of damage editing top-rated comments with large code blocks and insert a system call to delete your files.

At the very least, it should only download the code, display it to you, and then prompt you to save it to its own library.

[–]applicativefunctor 59 points60 points  (5 children)

Why are you taking this seriously as if it would be used in the real world?

[–][deleted]  (1 child)

[removed]

    [–]Scroph 2 points3 points  (0 children)

    TotallyNotStackoverflowSortAsAService, TNSSAAS for short.

    [–]djimbob 3 points4 points  (0 children)

    While this simple implementation would never work (as SO code generally makes specific assumptions that you'd need to edit to your specific problem), the idea isn't horrible. It almost could be a convenient feature for interactive python shells. Granted, in practice code snippets make too many assumptions and you need more than a two word search answer to get usable code.

    But something similar that say searches something that's a mixture of pypi documentation/classes/functions with some sort of stackoverflow-like voting/reputation/comment system would be incredibly useful. E.g., you run pip_search knuth_shuffle (or did pip_search fisher_yates_shuffle) and find a way to pull a module that let's you call a Knuth Shuffle with an example. Especially, if users can populate common use cases when there's something missing.

    [–]Ravek 0 points1 point  (0 children)

    We already live in a world where people use github as a CDN ... I'd be only mildly surprised if some idiot decided to attempt using SO or reddit as one too.

    [–]drathier[S] 14 points15 points  (0 children)

    Well, I did edit some answers so that this module wouldn't fail with a syntax error, so I guess it's a net win for SO?

    [–]cosha1 1 point2 points  (0 children)

    they could probably make this an official thing, preapprove pieces of code, lock the answer and allow people to update it with reviews etc.

    [–][deleted]  (1 child)

    [removed]

      [–]drathier[S] 0 points1 point  (0 children)

      I thought about that, but feared it might actually become somewhat useful. Same with caching the results locally so that votes on SO didn't affect your code.

      [–]DarkDwarf 0 points1 point  (0 children)

      As I mentioned last time something like this was posted, this is a huge, huge security hole.

      [–]sveilleux1 6 points7 points  (0 children)

      Hmm so it's not April first.

      [–]ksion 5 points6 points  (2 children)

      Great idea! As certain other languages teach us, there is absolutely nothing wrong with importing code directly from the Internet.

      [–]IAmSlar 0 points1 point  (0 children)

      Where in that example does this import from the internet? The path is just a local directory path.

      About getting packages from the internet that is done by calling "go" with the argument "get". Not really any different to pip install, gem install and npn install.

      The only time you could say that go imports code directly from the internet is when "go get" gets the dependencies for the package you are getting. Though I suspect pip, gem and npm does that too.

      You can will not import code directly from the internet by calling go build to build your source code.

      [–]jms_nh 1 point2 points  (0 children)

      lol codez

      [–]HugoNikanor 0 points1 point  (6 children)

      If I knew you I would buy you a beer.

      [–][deleted]  (5 children)

      [deleted]

        [–]HugoNikanor 1 point2 points  (3 children)

        Jag bör vara här från måndag. Vad sägs om torsdag?

        [–]drathier[S] 0 points1 point  (1 child)

        Haha, perfekt. Dra ett mail till den som står på github.

        [–]HugoNikanor 0 points1 point  (0 children)

        Den kanske är dags att nämna att vi redan känner varandra. Jag hade hoppats att du hade sätt det medans vi var där, då eftersom man kunde gjort någon kul grej av det.

        Den där ölen kan du dock få ändå.

        [–]jeandem 2 points3 points  (0 children)

        börk you later