Is there a best practice for reusing code snippets from Stack Overflow in production code?
Personally I always do something like this:
// Handling input that is not parseable as an integer.
// Courtesy of greyfade (http://stackoverflow.com/a/5655685/2947592)
cin.ignore(numeric_limits<streamsize>::max(), '\n');
Some related questions come to mind:
Is it perhaps wiser omit the contribution with regards to unclear issues with the licence (see Can we get some explicit clarification on the intended legal usage of code from SO answers?)
Is this contribution good enough?
Does a 1-line code snippet even warrant a contribution?
Should Stack Overflow offer a standard copy-paste template to make it easier to use proper attribution? ("Click here to use this code")