https://stackoverflow.com/help/licensing
I don't think I've heard anyone warn people not to copy code snippets from stackoverflow due to licensing issues, although "real" businesses should be rightfully concerned.
That's probably enough for attribution, but I suppose one could copy the author name as well.