Improving Page Speed on Heroku Cedar Stack with one EASY change
I just discovered a really easy way to improve page load times on apps hosted on Heroku's Cedar Stack. Before this change, my Page Speed Score, as determined by Google's Page Speed extension, was 69 on the most frequently loaded page. After applying this change, the Page Speed Score went up to 94!
The culprit is that on Heroku's Cedar Stack, your application's pages are not served through Nginx, and requests go straight to your web application. This means that gzipping of assets like your CSS and JS files doesn't happen by default anymore. The fix is easy - in your config.ru just add "use Rack::Deflater" before you "run" your application:
config.ru
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
use Rack::Deflater
run MySlowApplication::Application
This will gzip assets on their way to your clients, and, with any luck, give you a hefty performance boost!
TL;DR:
Use Rack::Deflater on Rails 3.2+ apps hosted on Heroku Cedar Stack to Gzip assets
Sources
Simplify your Git workflow with Legit
For many new users of Ruby and Rails, getting accustomed to Git can be a challenge. There are many situation specific commands to learn, and it can be intimidating for someone who has never used a SCM tool, or who is used to a much simpler one, like SVN. Also, Git commands do not follow a very obvious naming convention, and the decision to use one command or another can be daunting.
Legit aims to solve these problems, by providing some useful Git aliases and macros which follow a clear naming convention and simplify some of the frequently used Git idioms.
Take a look at the Git Legit homepage to see a list of the commands that Git Legit creates for you.
Automate your Ruby and Ruby on Rails workflow with the Guard gem!
Guard is a Ruby gem which will sit and watch for changes to certain files and perform different actions based on which files are changed. It is like Autotest except that it will work with any type of file and the action to perform in response to a change can be whatever you want. There is a healthy ecosystem of "guards" already built that you can use to monitor for changes to things like your Gemfile (run bundle install), coffeescript (compile to JS), Cucumber (run rake cucumber), and many, many more. I imagine that after a few days working with Guard I'll never want to go back!