I try to code for a half hour, take a brief break, then code some more. More often than not, I just keep going, and at some point the brain just slows down and I can't figure something out.
[insert red bull ad here]
I work in a small room at the top of my house; it doubles as my studio. I just took a 15-minute guitar break, and I'm ready to slay some code dragons again. I'm not shy; I turn it up and really dig into it, usually exploring some recent musical thought.
And it works every time--I'm back, refreshed, brain's sparking again.
No Red Bull or other additives needed.