I can tell you how NOT to do it
For me, if I don't go to work, I do OK. At work, wandering around from desk call to desk call, I know where all the fat bombs are located, and I have a difficult time detouring away from those.
Weekends I do pretty good because the snacks aren't as readily available. I have to walk 1/2 mile to the store to get them.