Impressive not only from a "ooo-that's-clever" perspective, but it's also readable, tweakable code. Many of these tiny JS toys aren't things you can really do anything with; this example is a great basis for learning.
Glad you liked it. It should be far more readable, though; the constraint here was code size in bytes, so even the non-minified code (http://gabrielgambetta.com/tiny_raytracer_full.js) is quite hacky (especially with the global vars, the horrible "tImageData" hack, the assignments within if conditions, putting all the sphere data in a flat array and playing with the indices,...)