I recently released Husvisningar.se with my friends Simon and Jacob. It has been, and is continuing to be a really fun project. We decided to use Ruby on rails for this, just to learn something new.
Ruby on rails is an open source mvc-framework that is used to build web applications with, some famous sites using it are Github and Twitter. According to it’s creator, David Heinemeier Hansson, the framework is optimized for programmer happiness and beautiful code. But this wasn’t the only good thing about it. There are tons of gems out there making it faster to create a site, and in almost every case there is someone else who has solved what you are trying to implement and shared the code. So I thought i’d share some good gems that we’ve used on our site.
Gems used on Husvisningar
Asset sync This gem syncs images, css and javascript assets to S3. This helps to load assets faster when serving them from a cookieless domain.
Chronic Chronic is a natural language date/time parser. So to get the date for next tuesday at 5 you can use Chronic this way:
Chronic.parse(‘this tuesday 5:00’) #=> Tue Aug 29 17:00:00
Stringex Stringex adds some useful extensions to the string class of ruby. For example it helps to remove unwanted chars when converting a string to use in a url.
“simple English”.to_url => “simple-english”
aws-sdk This gem is the official gem for amazon web services. Can be used for example if asset sync doesn’t fit your needs all the way.
MiniMagick A lightweight alternative to RMagick to scale images with ImageMagick. Using it is as simple as this:
image = MiniMagick::Image.open(“input.jpg”) image.resize “100x100” image.write “output.jpg”
RailsConfig RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner.
time_diff Gem which calculates the difference between two dates and returns a hash of time difference in terms of years, month, week, day, hour, minute and second.
Dalli Dalli is a high performance pure Ruby client for accessing memcached servers.