Code samples from the book Secrets of the JavaScript Ninja