If I ever take any code from SO, I include a comment with a link to it. Surely that's standard practice for anything longer than a line or two?
As GP says, no one really cares, but it seems hard to satisfy SA... even if you are pasting into open source, is your license compatible with CC?
Perhaps I'm over-thinking this.