A failproof way to avoid snacking is...
...piling a bunch of moving boxes in front of the fridge. You can't snack if you can't get to the food.
Granted, the mess was only temporary. But it was affective.
In the future, I am going to put the cookies on the shelf I can only reach with a chair.