1. I create "Today's list". This is little different than "To-do" list. Today's list contains tasks that I want to finish today - with each task assigned some deadline. Tasks are quite detail tasks - which takes 1-2 hrs. Like breakdown to features, bugs, reading chapter, etc.
2. I don't sit for long in front of computer in one stretch. I drink lot of water, so generally have to take breaks quite often. During that break (from computer) I talk to myself 2 things - "1. You're doing good - push more. 2. Now the next thing I want to do is _______."
3. Keep the browser/chat window closed if it's not required.
4. Even if I start reading HN/Twitter - I don't read everything. I know my time limits, I know things I want to build, so I know I cannot spend lot of time in consuming information. So just browse headlines, don't click every link. If headline is compelling, or source is trusted, then click it.
5. Keep deadlines - have pressure, and tell your deadlines to someone - friend, wife, colleague. Be answerable to someone. This trick worked quite often for me.