Ruby Projects

This is where my hacker side kicks in. I’ve got several things I’ve been toying with over the last little while and I thought I’d share.

NORM

This is more an exercise to increase my skills in Ruby. I’ve decided to write an ORM, sort of like ActiveRecord except that I’m doing things my own way so I can come to understand some of the tradeoffs between my methods and theirs. If you want to check it out, you can get the source code at https://github.com/charlesmaxwood/norm/tree

Indexer

This is a short piece of code that I wrote to count the number of occurrences of a given word in a given file. I ran it against some code at work and thought it was interesting what I came out with. I’d love to have feedback on the words occurring in other peoples’ code as well as suggestions to improve the simple script. Send your word counts and feature requests (or patches) to chuck@charlesmaxwood.com. Check out the code at https://github.com/charlesmaxwood/indexer/tree

Migration Helpers

When I first started programming Ruby on Rails full time, I worked with a developer who was a real stickler for data integrity in the database as well as in the models. I think ActiveRecord validators are pretty awesome, but I agree with him on the basis that a DBA could potentially give you some data issues if he were not forced to adhere to the intent of the code. Besides, standardizing data behavior makes things simpler. So, I created this library to help manage foreign keys.

I’m hoping to add a few other features to ActiveRecord migrations such as a :unique => true flag instead of using an add_index method call. Because I wrote this for work, they own the copyright, but they’ve allowed me to release it under the same licenses as Ruby. You can pick up the plugin at https://github.com/charlesmaxwood/migration_helpers/tree.

Relevance Search

Another feature of one of my projects at SolutionStream was search functionality based off of keywords on listings in the project. Each listing could have up to 6 keywords and needed to be listed by relevance based upon the keywords, the name, the author, and a few other attributes of the listing. The algorithm I was told to use involved building a temp table in MySQL and tabulating the data.

The search was pretty quick, so I wrote up this plugin after I left the project (and SolutionStream). The algorithm is not patented and the code is original to me, so I can release it for anyone’s use. Feel free to look it over and make suggestions. My email address is chuck@charlesmaxwood.com. You can get the code at https://github.com/charlesmaxwood/relevance_search/tree