The good thing to do is to roll it back. The reasoning behind this is that the question becomes useless without its code and can not help anybody anymore. The content posted here is under CC-Wiki content and is public. Changing the question/altering the question in such way that it is not answerable anymore is against the site policy. This is pure defacing.
After rolling it back, if you see that the user comes back and fights over the question to remove the code again, flag it for moderator attention. Use the custom flag, explaining what happened.
The mods can do some rollback-lock OR delete the question, if it's unlikely to help any other people.