High Tech Sorcery

Archive for March, 2010

Resources for working with ICalendar, Ruby, and Rails

by on Mar.25, 2010, under Ruby On Rails, Web Development

Icalendar is not fun to work with. If only there was a library that would make it easy and pleasant. Alas, that does not seem to be the case, but there are places to start.

There are 3 ICalendar libraries available as gems:

Beyond that I’d say anyone planning to work with ICalendar files should be prepared to dig into the reference.  I found iCalendar Specification Excerpts particularly useful.

1 Comment more...

Simple way to capitalize the first letter of each word in a string using Ruby

by on Mar.18, 2010, under Ruby On Rails

I am not infrequently looking to translate a string of either all lowercase or all uppercase characters to a string with the first character of each word capitalized.  I decided to see if I could come up with a quick and easy way to do this in Ruby.  This is what I came up with:


"STRING TO CAPITALIZE".gsub(/\b(\w+)/) {|x| x.capitalize}
=> "String To Capitalize"
"string to capitalize".gsub(/\b(\w+)/) {|x| x.capitalize}
=> "String To Capitalize"

It’s not perfect as I think it will choke on quotes but good enough for 5 minutes worth of work.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...