Some ruby code I've written over the years.