miscellaneous commonly used bits of javascript