Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mathildathompson/7520188cdd3ed2f997db to your computer and use it in GitHub Desktop.
Save mathildathompson/7520188cdd3ed2f997db to your computer and use it in GitHub Desktop.
#script tags are blocking operations, it cant do anything until it gets the script back;
#Remember it has to request all of the script links individually from the server;
#On heroku it will only include one script file and one css file which will be much faster as doesnt have to make lots of request to the server;
#It is hard to debug stuff on heroku;
#You can ask rails to run the production environment locally;
rails server -e production #If you are having a problem that only appears in production, you can make the production environment run locally;
#If you want to run production locally you have to run a rake task locally
RAILS_ENV-production rake assets:precompile #It will compress javascript and css into a single file;
config/environments/production.rb serve_static_assets = true
rails server -p 3001 #You can run multiple rails servers at once if you specify a new port;
Have a look in the pageSpeed tab #Have a look at the googleIO video;
#How to get rails to minify your html;
#Google take response time into account when they are ranking things;
#Use cdn as the user likely to already have it cached;
#As long as your scripts are making requests to different servers you can make requests in parrallel, good idea to use a CDN;
#Chrome can now make up to 4 reauest on the same machine at the same time;
#The disadvantage of CDNS is that you are dependent on the CDN, if the server goes down you are FUCKED!
#Have the CSS at the top, all the CSS will be loaded at the top thus you will see stuff with styling;
#Your javascipt should be at the bottom of the page after the page has been loaded;
#Move your javascript so it is just before the closing body tag;
#Modernizer needs to be at the top of the page; Modernizer makes old browsers behave like new browsers;
#Evertime you use a different domain name it needs a IP address to look up that name, thus avoid using too many different domain names;
NEW RELIC
gem 'newrelic_rpm'
config newrelic.yml #Add the yml file here;
#Inside this file change:
development:
*default_settings
# Turn off communication to New Relic service in development mode (also
# 'enabled').
# NOTE: for initial evaluation purposes, you may want to temporarily
# turn the agent on in development mode.
monitor_mode: true #change this to true;
#Push your code up to heroku;
#Connect to your application and have a look at the analytics;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment