Programming

rails

Getting started with Ruby on Rails

These are some of the tutorials and guides I’ve found most helpful while picking up Ruby on Rails 3.

Ruby language:

Installing Rails on Windows:

Best “my first app” walk-through:

Using “remote” to ajaxify links and forms:

“Unobtrusive JS” library that ships with Rails 3:

Use Twitter Bootstrap with Rails:

high performance web sites cover

Rules for optimal web site performance

I’ve been working to improve the performance a large site at Amazon.  Steve Souders has written two excellent books that explain browser/http best practices.  A few of the rules were new to me and very helpful (flushing/mod_deflate settings, different browser techniques to defer Javascript).  The important take-away is that only a small fraction of typical page load time is bottlenecked by the server generation of a page.

High Performance Web Sites
(companion site)

  1. Make Fewer HTTP Requests
  2. Use a Content Delivery Network
  3. Add an Expires Header
  4. Gzip Components
  5. Put Stylesheets at the Top
  6. Put Scripts at the Bottom
  7. Avoid CSS Expressions
  8. Make JavaScript and CSS External
  9. Reduce DNS Lookups
  10. Minify JavaScript
  11. Avoid Redirects
  12. Remove Duplicate Scripts
  13. Configure ETags
  14. Make AJAX Cacheable
Even Faster Web Sites
(companion site)

  1. Understanding Ajax Performance
  2. Creating Responsive Web Applications
  3. Splitting the Initial Payload
  4. Loading Scripts Without Blocking
  5. Coupling Asynchronous Scripts
  6. Positioning Inline Scripts
  7. Writing Efficient JavaScript
  8. Scaling with Comet
  9. Going Beyond Gzipping
  10. Optimizing Images
  11. Sharding Dominant Domains
  12. Flushing the Document Early
  13. Using Iframes Sparingly
  14. Simplifying CSS Selectors

My first round of optimizations just went into production and our metric that measures “time from click until critical feature shows up in the browser” dropped from 5.25s to 3.5s. It’s neat to multiply the savings and see that many weeks of end-user browser load time are saved each day.

StepMania installer .dmg

Tools for creating MacOS installer .dmgs

StepMania installer .dmgI spent some time updating the StepMania MacOS installer. There are many features that you probably will want in an installer dmg:

  1. an “Applications” link or alias
  2. a custom background image
  3. custom placement of icons
  4. .dmg compression
  5. a way to script building of an installer dmg

Here’s how you’ll want to achieve the above in your installer build script

  • Create a temporary directory and copy into it all files you’ll want in your final .dmg (typically a .app or 1 directory, and maybe a documentation file)
  • Create a symbolic link (ln -s /Applications $your_temp_dir) or manually make an alias to /Applications and then copy the alias to your temp directory.
  • Use the yoursway create dmg script and pass in your temp directory, background image, icon locations, and it will spit out a compressed dmg.  Something like: create-dmg –window-size 500 300 –background background.png –icon-size 96 –volname “StepMania4″ –icon “Applications” 380 205 –icon “StepMania” 110 205 StepMania.dmg ../$temp.dir.  Their script is based on the Adium installer applescript + wrapper.

You can see exactly how StepMania does it by checking out our scripts: https://svn.stepmania.com/svn/branches/4.0/stepmania/PBProject