You find something else to do. I've never been able to quit an addiction without replacing it with another addiction. It went TV -> MUDS -> Magic: the Gathering -> Star Wars CCG -> writing my own MUD -> electric guitar -> MUDS again -> Harry Potter fanfiction -> C2 & programming language design -> sailing -> Reddit -> News.YC -> Scrabulous -> my startup -> Arc -> hopefully back to my startup again, though I can't be sure of that...
Luckily, if you get to a certain point in a "constructive" project (like a piece of software), it'll start to pull you along and becomes less of a chore and more of an obsession. Unfortunately, it's pretty easy to interrupt that obsession, which is why I should stop overriding my 10-hour noprocrast timeout on news.YC.