Yes, you can do that, but the effect might not be exactly what you expect.
According to the Stack Exchange TOS:
You agree that all Subscriber Content that You contribute to the Network is perpetually and irrevocably licensed to Stack Exchange under the Creative Commons Attribution Share Alike license.
This says that you must license under CC-SA. Nothing prevents you from also licensing under something else.
However, if someone is getting information from Stack Exchange, they themselves must follow the TOS, and the TOS says:
In the event that You post or otherwise use Subscriber Content outside of the Network or Services, with the exception of content entirely created by You, You agree that You will follow the attribution rules of the Creative Commons Attribution Share Alike license as follows:
You will ensure that any such use of Subscriber Content visually displays or otherwise indicates the source of the Subscriber Content as coming from the Stack Exchange Network. This requirement is satisfied with a discreet text blurb, or some other unobtrusive but clear visual indication.
You will ensure that any such Internet use of Subscriber Content includes a hyperlink directly to the original question on the source site on the Network (e.g., https://stackoverflow.com/questions/12345)
You will ensure that any such use of Subscriber Content visually display or otherwise clearly indicate the author names for every question and answer so used.
To remain in compliance with site TOS, I think they'd still have to obey those rules if they get the code from your post, even if your alternate license allows otherwise. (Of course, if they get the code from somewhere else, they could ignore this.)