Add Grunt tasks for JSHint and Karma

This adds [Grunt](http://gruntjs.com/) tasks for tests and JSHint. It also includes some linting fixes.

To lint and run the tests, run `npm test`. We should be able to add Travis CI integration based on this also.