Freedom: a Mac app that gives you up to three hours of internetlessness
ibiblio.org
ibiblio.org
https://addons.mozilla.org/en-US/firefox/addon/4476
It will allow you to block time consuming websites at time you configure.
I block Reddit, Digg, and Hacker News throughout the day with the exception of the first hour of the morning, over the lunch hour, and from 5:30pm on.
Just develop some freaking self-control.
More difficult would be allowing access to programming documentation on the web while rejecting time-wasting web sites. One idea is to reject any web page that has changed in the last 24 hours on the theory that the time-wasting sites are constantly changing (are topical) whereas the sites you need to do your work are not. (I do not know if it possible programatically to determine when a page last changed.)