Archive for March, 2010
Resources for working with ICalendar, Ruby, and Rails
by specialj 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:
- iCalendar – version 1.1.3 released 3/2010
- iCalendar home – rdoc
- RiCal – version 0.8.5 was released 9/2009
- RiCal home – links to rdoc, google group, bug tracker
- GitHub
- Author’s Blog Posts tagged with “RiCal”
- vPim – version 0.695 was released 3/2009
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.
Simple way to capitalize the first letter of each word in a string using Ruby
by specialj 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.