Over the years, I've found that the best ideas come to me when walking to the bathroom and back. Especially when I'm trying to come up with a good solution to a difficult programming problem. Just getting up from the screen and engaging in some mindless physical activity seems to cause my subconscious to spit out surprising insights that I wouldn't have come up with if I had been 100% focused on the problem at hand. It's really a bit of a mystery how the human brain sometimes works this way.