Write drunk, edit buzzed, then?
Caffeine-code is much easier to follow later.
I also sometimes find solutions to hard problems in my head when stoned, though I usually just write down the solution rather than coding it, as large-scale implementations are better done sober.
They were working in C, which makes it a lot easier to introduce subtle bugs than most languages, but I certainly think twice about coding while under the influence since I heard that story!
I can make plenty of those.. and I've never had beer.