One trick to help get started is to make it just annoying enough to switch to the distracting task that you don't bother. Editing your hosts file which you then have reverse before surfing the distracting stuff, creating a separate login for the distracting stuff, closing your laptop lid on every task switch[1], etc.
Thank you for that; I recently tried to find out how he implemented his 30 second distraction-delay but I had misattributed the quote and so my search was unsuccessful. I think that the delay is a powerful idea.
The approach I'm experimenting with is a "productivity mode" toggle in a tiling windows manager which disables most of the windows manager commands, leaving me mostly stuck in whatever application(s) were already visible until I toggle it off. The toggle off function has a 30 second delay.
[1] http://blog.xkcd.com/2011/02/18/distraction-affliction-corre... This works surprisingly well