config.action_controller.asset_host = Proc.new do |source, request| non_ssl_host = "http://assets#{source.hash % 4}.github.com" ssl_host = "https://assets#{source.hash % 4}.github.com" if request.ssl? if source =~ /\.js$/ ssl_host elsif request.headers["USER_AGENT"] =~ /(Safari)/ non_ssl_host else ssl_host end else non_ssl_host end end repo = Grit::Repo.new(RAILS_ROOT) js = repo.log('master', 'public/javascripts', :max_count => 1).first css = repo.log('master', 'public/stylesheets', :max_count => 1).first ENV['RAILS_ASSET_ID'] = js.committed_date > css.committed_date ? js.id : css.id