I love reading code like this. Breaking up algorithms and figuring out how they work is a great way for me to broaden horizons instead of sticking to what’s worked in the past. Getting some context behind the decisions I make has proven to be really valuable.
This piece of code for example, will reorganize a list of images into a visually pleasing way much like Masonry but implements a solution to the Knapsack Problem. That leads me to my second point. Snooping around open source code often lands me on Wikipedia pages that explain problem patterns I hadn’t read about before, or maybe have but since forgotten.