What's eating you? Who are you eating for? What part of yourself needs nourishment, and what part is being asked to digest food (physical, mental, emotional, spiritual) and distribute it? Are you really hungry or stress hungry?
And if you are up right now, did you act on the urge to have that late night snack? Was it awesome? Do you feel nourished and taken care of? If so, excellent! If not, stop beating yourself up. Stop it right now. Take a breath and ask yourself what you really need. If you don't know, at least you know it wasn't what you just ate, so next time, you can cross that off the list of options.
This is one way we can learn to stop judging ourselves. Assess the result from a scientist's point of view: did the action have the desired effect? If not, what different actions can we try next time until the desired effect us achieved.
The science of non judgement. The science of self love. The discovery of your limitlessness through limiting your options. But that's another story.