I've been trying to get back my focus on developing that I used to have, my "being in the zone" so to say, for a while now - and tonight I thought of something, and it worked! I decided to think back to the last time I was really focused on programming, which was in 2005, and looked up the music I listened to back then - this turned out to be stuff like Armin van Buuren. And guess what, I was able to focus like I used to again!
Tl;dr if you're having issues focusing as a developer, try removing all distractions (IRC clients, forum tabs, etc), and play some music from the last time you could really focus on programming and enjoy it - maybe it'll help for you too :)