I was wondering this same thing not too long ago. I ended up finding that CC-BY-SA 3.0 is one way compatible with CC-BY-SA 4.0, which is one way compatible with GPLv3.
Therefore, you can relicense what you find at StackExchange under GPLv3. This helps immensely in including SE-found code in a GPL project, because you won't be able to dual-license that project back into CC-BY-SA.
EDIT: There's one (small) caveat to this: according to the license text, you can't just relicense it willy nilly, you must adapt it first. See this question for more information (thanks to unor for pointing this out). However, including the source code in a larger project would be classed as adaption, IMO - just don't try to relicense only that source code you've found, verbatim, with nothing else along with it.
EDIT 2: If the code isn't copyrightable at all - i.e. it's an idea; it's not original enough etc. - then do what you like without restrictions! This answer on meta covers the options.
It's also worth noting that some people on StackExchange apply non-viral licenses (such as MIT, or even public domain dedication) to their posts in their profiles, which gives you more freedom for their code too (providing it is their original code).
Others may happily give you permission if you ask them. :)
This should still all be done at your own risk though, because you don't actually know for sure where code posted on StackExchange has originally come from.