My biggest rule is to eat before I am starving. I find I make the worst food decisions when I am ravenously hungry. 

One easy way to do this is to slam a protein shake before any event where you know that you are about to ask your brain to resist the temptation of a donut.