How eerie, I had literally just (10 min ago) searched for something like this on Google and Github; I wanted to looked into dynamic generation of patterns but the only thing I could find were simple stripes and tartans. Cool stuff.
It has pseudo code and a bunch of illustrations. (http://www.amazon.com/Computers-Pattern-Beauty-Clifford-Pick...)