Add hashes to JS and CSS files for cache invalidation

Only do it for JS on production as requirejs makes this hard on
development and it shouldn't really be needed there either.

When I say it makes it hard I mean that because it's requesting lots of
files and then using the path of those files as the module name putting
in place the code to resolve this is both painfully manual and hence
error prone and also problematic because of the way require handles
fetching. Given cache busting is only really an issue with production
deployment it's not worth the pain.

For #554
allow memberships to be deleted and added at same time

If you added a new membership to a person then the list of ids passed to
the nin query would include an undefinded entry. As all the membership
id of a person were not undefined this would result in the query
never selecting any documents. We now filter out any undefineds from the
id list to prevent this.

Fixes #600