Verify hosted examples at precommit time

This PR adds a PhantomJS script to verify that the hosted examples load without error. With this script we can catch missing exports and uses of `goog` at precommit time. We won't catch everything, but I guess it's better than nothing.

This PR also fixes issues that the PhantomJS script revealed.

Please review.