This might be a joke but everybody does it manually for real. Whenever I copy-paste some tricky function from SO I like to add a code comment with the url pointing to the stackoverflow.com answer. This allows future maintainers to refer back to SO and see if a better answer has surfaced or read comments about any issues.
Almost 3 years ago Visual Studio demo-ed a feature that would copy-paste code from StackOverflow, while automatically renaming the variables to fit your code :
I never, ever copy paste code, unless it's really long. I always end up rewriting everything myself, so I have the time to think about what's happening.
Hmmmm. I'm the other way round. I copy and paste short snippets because I'm lazy and I can see if they are ok at a glance. Longer code I'll go through line by line and try and 'touch' each line to force me to think about it.
I've worked with people who did it with pride. When I pointed out we had no license for the code, they proudly told me anything without an explicit license was public domain.
StackOverflow code is under a license - cc by-sa 3.0. They were planning on clarifying this by moving to the MIT license, but there was some pushback on that and they are holding off for now at least: https://meta.stackexchange.com/questions/272956/a-new-code-l...
Besides that, most snippets are small and trivial enough that using them would easily fall under fair use.
Obviously, your case showed a lack of care on their part, but you can use SO code.
How do you know how to loop over an array for (int i=0;... ? You didn't invent that code. You read it somewhere many years ago and have copied it over and over many times since then. Do you have a license for that code? The author you learned it from did not invent it either, was he violating a license? It wasn't even invented by Dennis Ritchie since he copied the idea from earlier languages.
My point is that trying to copyright basic snippets of code is just ridiculous, it's something lawyers have tried to force on programmers but it makes no sense. We would be completely unable to program at all if we listened to lawyers all the time.
Well, actually I just typed [] in my browser's console, expanded it, then expanded the prototype and found a method called "forEach" which sounded like what I wanted. Fiddled with it a bit until it worked.
Awesome. Now we just need to integrate upwork with our IDE so I can just write the method signature and a bid price and my method will be magically implemented.
It's interesting to imagine adding something like this to an editors auto complete or as some kind of search function to automate functions you've coded a million times.
I.e. maybe you type: "repeat a function over a list python" in a special format and your editor pastes in the accepted answer from stackoverflow for you to choose whether that's acceptable / whether you want to use it as a template. Then maybe you could get into a better flow without ever having to stop what you're doing to Google something ... It would all just show up magically in your editor.
You could even have libraries of common answers written in such a way that you could write expected input and output formats and then get a code fragment that would fit that description. Something like a more organized test driven development. Though that would really only work for very specific things. Improve these ideas enough and make them more general - and maybe you could improve programmer productivity by quite a large margin.
Disclaimer: I know the OP was a joke but I see no problem with reusing code if you understand what its doing and the costs / trade-offs for doing so.
It seems pretty apparent from the readme that it's a joke along the lines of "If you're going to just copy and paste the first thing you find on Stack Overflow, you may as well do this."
I often find that the accepted answer with the most votes is the oldest and often outdated and that there's a newer answer with also a lot of votes which is more up to date and better many times.
How could a system that executed arbitrary code ever make such guarantees? I mean sure, if there were a magical thing that only ever produced correct code for what you wanted to do I guess people would use it.
> We believe in the power of community editing. That means once you've generated enough reputation, we trust you to edit anything in the system without it going through peer review. Not just your posts—anyone's posts!
If you've been on Stack Overflow enough, you might have noticed that crap is sometimes approved even after peer-review. Many doing the review do it like robots (to earn internet reputation and badges).
This is a really stupid idea, even as a joke to play with. Someone can just edit the top answer to make it malicious and steal your personal or work data from your workstation.
This is a pretty cool idea! Concerns for running unknown code aside, it seems like the results of this type of thing would be prone to potentially frequent change.
I wonder if there'd be a way to maintain consistency, something like a requirements.txt file that got spit out to describe what the results of the search terms mapped to when the code was run.
It could just contain the search term and link to the chosen question. Although you'd still run the risk of the answer itself being edited. The code itself would have to be cached in whatever this file was.
What a fascinating concept! I think that with some kind of review built in, this kind of dynamic loading would be really useful.
I think if you do this, you'd want external tests, or some way to pull the code in and "freeze" it so that you wouldn't be at risk of external compromises. (For example, a high ranked SO user might be able to change a highly ranked answer . They might not do it, but someone suborning their account might.)
But really, this is an optimization of a lot of code that is currently written.
I don't see this being useful for real programs, but it could be amazing for interactive use in a shell. I use iPython for all sorts of quick data manipulation daily, and being able to just quickly type an idea and get it would be amazing.
"StackSort connects to StackOverflow, searches for 'sort a list', and downloads and runs code snippets until the list is sorted."