Stack Exchange applies CC-BY-SA to all posts. How does this interact with free or open source licences? If someone wants to ask a question about a piece of open source software can they post code snippets into their question or would some licences prevent code being posted under CC-BY-SA?
If it's just small snippets, then that likely falls under fair use. In that case, the license doesn't matter and you are allowed to post them.
Though how small exactly would the snippets have to be is not specified, so you should be really careful about keeping them really small.
It depends on the license and the owner, but likely no.
If the code you want to post is licensed under GPL, don't even think about it. GPL has strict share-alike restrictions, so you must reshare under the same license. Posting to SE shares under CC BY SA, so violates these terms. Other licenses may have similar; I don't know them all.
Obviously, if you're the owner then ignore the whole lot of this and do as you like. If you're not, but you can contact the owner, you should consider doing so. You can ask them to relicense the work solely to you because you want to post it to SE (add details about SE and why this is a good purpose), or to make an exception. This relies on their generosity, but many devs will be happy with this.