Mike Bostock's d3.js javascript as beautiful as the visualizations it creates.
Javascript is pretty popular now, it gained new footholds with server side code with things like node.js and the popularity of client side libraries like jQuery. I have notice one things for certain there is a lot of very elegant code being product in javascript. This particular bit of code caught my eye.
For the lay person, If you have have to draw a chart or graphic based on some numbers (data) you need to make sure it fits in the chart or graphic. The way you do this is make sure that the numbers scale to fit the area. For example if you have a 50 foot builing to draw you might say each food is a pixel heigh (pixel is a dot on the screen) This is usually programmed in a tedious manner. (If you don't get it just admire the graphics on the post.)
If you have done a bit of coding in your time I am sure you have tried to code a set of data to be scaled/normalized for a chart or graphic. Below this scalling is done in a elegant way, automatically creating a function that maps a data set to a range. The second example of this does something cooler it maps a input data range to a color range. The beauty of first-class functions
Example 1:
var x = d3.scale.linear()
.domain([12, 24])
.range(["0px", "720px"]);
x(16); // 240px
Example 2:
var x = d3.scale.linear()
.domain([12, 24])
.range(["steelblue", "brown"])
.interpolate(d3.interpolateHsl);
x(16); // #3cb05f
Javascript has come a long way since my first javascript code in 1997, I am amazing it's progressed this far.
If you like elegant code read the last link that Mike wrote, it's good.