Try the Pomodoro Technique. Basically, code for 25 minutes, take a 5 minute break. After 4 coding sessions take a 15 to 30 minute break. Protect the pomodoro!
https://en.wikipedia.org/wiki/Pomodoro_Technique
https://www.youtube.com/watch?v=WqBuh4HWu8U
http://lifehacker.com/productivity-101-a-primer-to-the-pomodoro-technique-1598992730
https://en.wikipedia.org/wiki/Pomodoro_Technique
https://www.youtube.com/watch?v=WqBuh4HWu8U
http://lifehacker.com/productivity-101-a-primer-to-the-pomodoro-technique-1598992730