There's a nicely formatted gist right here, or you can read it inline below:
Yes, that large hack floating around in the middle is specifically for Heroku. If you're on another cloud service that is a little less wizardly, you can drop the class_eval block entirely and you should be good to go.
If you're wondering if the resultant files will be cached by Heroku's Varnish HTTP accelerator: yes. Rack::Static will return the fetched files as Rack::File objects, which Heroku caches.
UPDATE: if it's not obvious, this needs to go into config/initializers -- so it runs once on app start up.