I recently spent some time working at Agora Games. During my time there, I ended up writing a pure ruby mpq (Blizzard game file format) parser specifically for StarCraft II replays.

Google Codejam in Haskell

I’m currently learning Haskell by reading the book Real World Haskell. Usually, when I learn a new language, I like to play around with some programming puzzles online at places like a problem from the Google Code Jam archives.

I started this with a brute force solution, actually simulating a chain of snappers. It worked well for the small input set, but predictably failed on the large input set. I started analyzing the problem and found an equation that solves it based on the number of snappers and the number of snaps which now solves the problem in O(1) time. The equation I came up with is different than the given analysis (which makes use of xor), but I’m still happy with it.

All of the magic is in the isOn function. The rest is input and output management.

Complex Forms With UJS in Rails

Complex forms used to be fairly difficult to put together in rails. Rails 2.3 made it a little easier with nested attributes, but the hardest part, for me at least, was adding new object fields via javascript. There is quite a lot of this going on in a project I’m currently working on and I’ve come up with a new system utilizing Rails 3’s spiffy new ujs support.

The only downside I’ve run into so far is the slightly messy markup that renders the field html inside the link.

Have a better way, or know how to improve this code? Let me know in the comments.

Mathematics is like unicorn anatomy. You imagine this thing, and it doesn’t exist, yet it still comes with facts. I know how many legs a unicorn has.

Relatively Early’s latest project: a social network for audio engineers.  You can read more about it on Ross’s Blog.

A command line interface for creating git branches based on lighthouse tickets.