Your unsexy answer is pretty effective. When i need to produce a lot of code, i have green tea, earplugs that block ~ 30dB of ambient sound, a good ergonomic space for 2 laptops and monitors, plus: guitar and fretless bass for regular breaks, and.. shredded oat cereal. Don't laugh, it takes no time to prepare and doesn't have drastic insulin effects. I think the guitar breaks actually has biggest lift for concentration, memory and steady energy.
Douglas Hofstadter (sp?) in Godel Escher Bach postulates a link between music and maths (and hence programming - though perhaps that should be 'certain kinds of programming')