parker's stuff
 

The algorithm for a perfectly balanced photo gallery →

Really cool look at how Chromatic handles building their photo galleries according to this spec:

Galleries typically have between 10 and 100 photos with various aspect ratios (that’s width divided by height) and we want them to be equally distributed over the rows, taking up all the space available.