Cory O'Daniel – These are just words Software development, thoughts, and randomness

6Oct/110

Screen shots of Steve Jobs Homage Pages, and Smarmy comments.

This is just a few screen shots of some big software companies with homages on their home pages to Steve Jobs. These are listed from Classy to Least Classy.

Apple
Apple - Steve Jobs Homage
Well of course they have one.

Google
Google - Steve Jobs Homage
Despite the phone war, classy Google - Very classy.

Adobe
Adobe - Steve Jobs Homage
Bastard wouldn't let your crappy software on his iOS, but a little reminiscent photo. *Respect*

Microsoft
Microsoft - Steve Jobs Homage
"Steve Jobs is dead, btw do you have an XBox 360 yet? Apple never made a console - Just sayin'"

Dell
Dell - Steve Jobs Homage
"Who the fuck is Steve Jobs?" Michael Dell! *Tsk, tsk* That's just rude.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

24May/102

Lost finale – did i get it?

I think I understood the lost finale? What I understood was that everything that happened on the island was REAL. It all happened. The monster, the time travel, the dharma initiative. Everything. As the losties died off they went to the side world where they could meet up and "move on" together. So when we saw the plane leave, those people left the island, went on to have lives and eventually died. Hurley and Ben stayed on the island for however long and eventually died.

This is supported by the following statements I think?

Hurley to Ben - you were a good #2

Christian to Jack - everybody dies some die before you some die way after you

Christian to Jack - the time on the island was the most important part of your life

Am I on the right track?

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tagged as: 2 Comments
17Mar/092

MovingParts: Auto versioning your Javascript and CSS

This tutorial has a few moving parts.  It could be easily recreated with any stack, but for this post I used Nginx and Merb.

Why?

We like to keep things fast.  Two ways we do that is compress the hell out of our js/css and set the cache time on our assets to max.  This is cool to do and obvious, the thing that sucks is when its time to roll out new javascript or css making sure the clients get the updates.

What?

For this example I am using merb and merb-assets (w/ my latest merb patch), nginx and ruby-yui.

Step1 - Add version info to assets with merb-assets

In our code base we have a version for our site, set in a variable like WWW_VERSION.  Using this variable it is easy (with the newest merb-assets plugin) to modify the path of all of your assets on the fly.

Stick this in your init.rb...

1
2
3
4
5
6
7
8
9
10
11
12
 
WWW_VERSION = "0.1.0"
 
# this will make require_js "application"
 
# => /javascripts/application.0.1.0.js
 
# instead of /javascripts/application.js
 
Merb::Plugins.config[:asset_helpers][:js_suffix] = ".#{WWW_VERSION}"
 
Merb::Plugins.config[:asset_helpers][:css_suffix] = ".#{WWW_VERSION}"

 

At this point in time merb is going to start outputting modified paths to your assets that contain version numbers.  This is cool because now when we modify javascript or css and bump the version number it will cause the clients that have cached the static assets to redownload them since the file path is different.  The part that sucks is renaming a bunch of javascript and css files.

Step2 - Lying about file names

Renaming a bunch of files does suck!  So don't do it.  Instead have that sneaky russian Nginx lie about it for you.

Stick this in you nginx.conf...

1
2
3
4
5
6
7
8
9
10
 
location ~ ^/(javascripts|stylesheets) {
 
  rewrite ^/(javascripts|stylesheets)\/([^\d]+)(?:\.[0-9]+)*\.(js|css)$ /$1/$2.$3;
 
  expires max;
 
  break;
 
}

This rewrite rule will make nginx route any javascript/stylesheet to the original file if it contains a version number.  So a request like to '/javascripts/application.0.1.0.js' will be rewritten to '/javascripts/application.js'.  Nifty.

 

Step3 - Compress those assets

You can compress your assets in a number of ways, I'll go with shameless self promotion and recommend RubyYUI.  RubyYUI is a ruby wrapper for the Java-based YUI  Compressor.  It lets you glob paths instead of doing one file at a time and add suffixes to files.  All sorts of things.

You can do something like this in a vlad or capistrano task during deployment.

1
2
3
4
5
6
7
8
9
10
 
require 'rubygems'
 
require 'ruby-yui'
 
# this will cause the files to be compressed in place
 
Yui.new("./public/javascripts",:stomp => true, :suffix => nil).compress
 
Yui.new("./public/stylesheets",:stomp => true, :suffix => nil, :type=>:css).compress

 

Now you have compressed assets in place in your deployed app and nginx will rewrite any versioned paths to your compressed files.  Bump your version number and all your clients will start getting the new compressed files.  Wee.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon