Random JS snippets and miscellaneous solutions to miscellaneous problems