title: Snap: correct use of PreRun hook
body: <p>I cant figure out how to run a function before any template loads.
  For instance:
  I have a function called 'authenticate' that returns a Maybe value. I want to run it before any template is loaded and then redirect conditionally.
  I believe the PreRun and OnLoad hooks should do this but I don't know how to use them.</p>
  
  <p>Can someone please show the correct usage of those hooks to implement the above example?</p>
  
  <p>Thanks</p>