Sinatra utf-8 Content-Type before filter April 22, 2009
Posted by John Dewey in Code, Example, Sinatra.add a comment
I wanted to learn Sinatra, so I started converting my personal Rails site over to Sinatra. I scrape my Twitterholic rating, and redisplay it on my site. I need the css and html to have a Content-Type of utf-8.
I came up with the following before filter. There is probably a better way to do this, I just wanted my controllers to be less “wet”.
I also use the following to render all css.
Running Sinatra with Phusion Passenger April 19, 2009
Posted by John Dewey in Passenger, Rack, Ruby, Sinatra.1 comment so far
gem install that (well kind-of) April 11, 2009
Posted by John Dewey in Code, Plugins & Gems.add a comment
Geminstallthat is a pretty groovy name, which reidmix came up with. What would be really geeky is a gem named ‘that‘, which allows you to read my blog. I didn’t feel like dealing with rubyforge (to get the non-githuby gem name) , so here is a sneak peek at that.
$ gem sources -a http://gems.github.com $ sudo sudo gem install retr0h-that Successfully installed retr0h-that-0.0.0 1 gem installed Installing ri documentation for retr0h-that-0.0.0... Installing RDoc documentation for retr0h-that-0.0.0... $ that
It will display all posts from the time the gem was built to Time.now.
Syncing bundle_fu assets to s3 for Cloudfront April 2, 2009
Posted by John Dewey in Amazon, CDN, Rake, Vlad.1 comment so far
I wanted to automatically upload my bundle_fu assets to Amazon’s s3, and use their Cloudfront CDN for SnGs. I came up with the following rake task, which can be hooked into Vlad.
It’s as simple as adding the following to production.rb, and running the rake task ‘cloud:upload’.
ActionController::Base.asset_host = "cloudfront_url"