You’re reading Signal v. Noise, a publication about the web by Basecamp since 1999. Happy !

Sam Stephenson

About Sam Stephenson

Programmer at Basecamp.

gmail-password-recovery.png

A thoughtfully worded message pops up after a few minutes of idle time reminding you to set an alternate email address in case you lose access to your Gmail account.

Sam Stephenson on Aug 10 2009 6 comments

Introducing Sprockets: JavaScript dependency management and concatenation

Sam Stephenson
Sam Stephenson wrote this on 29 comments

For a long time we’ve been struggling to manage the growing presence of JavaScript at 37signals. We needed a way to share common JavaScript components and behaviors across our applications and web sites. And we wanted the ability to organize our JavaScript source code into multiple files and folders without the overhead of including dozens of <script> tags on every page.

So we scratched the itch by creating Sprockets.

Sprockets is a Ruby library that preprocesses and concatenates JavaScript source files. It takes any number of source files and preprocesses them line-by-line in order to build a single concatenation. Specially formatted lines act as directives to the Sprockets preprocessor, telling it to require the contents of another file or library first or to provide a set of asset files (such as images or stylesheets) to the document root. Sprockets attempts to fulfill required dependencies by searching a set of directories called the load path.

It helps you turn messy JavaScript into clean modules for development and a single .js file for deployment.

Continued…

Defensive design: Magnetic zones on the unibody MacBook

Sam Stephenson
Sam Stephenson wrote this on 17 comments

To access the RAM slots in a unibody MacBook you must first remove the back plate—a thin piece of aluminum attached by eight tiny screws. Half of the screws are hidden beneath the battery cover, and each one is surrounded by a recessed magnetic zone. The purpose of these zones is ostensibly to help keep the battery cover seamlessly attached to the case.

MacBook magnetic zones

But removing the screws made it clear that the magnetic zones serve a second function. When my screwdriver slipped, the screw didn’t fall into the depths of the case. Instead, it flew right over to the magnet, and I was spared the pain of extracting a three-millimeter needle from an expensive electronic haystack.

It’s a perfect example of real-life defensive design: anticipate where your customers might slip up and try your best to keep them from doing it. Have you encountered any good defensive design lately?

Apple's MobileMe drops support for IE 6

Sam Stephenson
Sam Stephenson wrote this on 65 comments

Apple announced a rebranding of their .Mac service earlier this morning. It’s now called MobileMe and features online versions of Mail, iCal, and Address Book, so you can access your email, calendars, and contacts (watch a demo) from any PC.

Any PC not running IE 6, that is. From the email sent out to .Mac subscribers just a few minutes ago:

To use the new web applications, make sure you have one of these browsers: Safari 3, Internet Explorer 7, or Firefox 2 or later.

There’s still a significant number of PCs out there running IE 6, usually corporate machines that need to access intranets or other web apps that only work with that browser. A quick look at the stats for Basecamp’s marketing site shows that 31% of all IE users are using version 6.

So it’s interesting that MobileMe is the first major web application (that I know of, at least) that’s dropped IE 6 support completely. It’s a gutsy move, since Apple’s billing it as a way to access your data from anywhere.

And I’m hoping it’s the beginning of a trend. IE 6 is definitely the most painful browser for us to support – it’s seven years old and doesn’t even fully support the CSS 1.0 standard created in 1996. Microsoft’s done an incredibly poor job of getting users to upgrade. It looks like it’s going to take pressure from big apps like MobileMe to seal the deal.

Tip: Prevent iPhoto from opening when you plug in your iPhone

Sam Stephenson
Sam Stephenson wrote this on 56 comments

I love that OS X automatically fires up iPhoto when I plug in my digital camera. It’s one of the Mac’s many little touches that make it such a pleasure to use.

But ever since I got an iPhone, I’ve been frustrated that plugging it in opens up iPhoto, too. The combination of iPhoto and iTunes opening and syncing slows my computer to a crawl. And it’s particularly painful when most of the time I just want to sync my address book or music.

Fortunately it’s pretty easy to work around this annoyance. Keep reading to see how you can teach your Mac to open iPhoto when you plug in your camera but not your phone.

Continued…

Feeding our keynote addiction with Campfire

Sam Stephenson
Sam Stephenson wrote this on 7 comments

When an Apple keynote event is underway, we can’t help but load up the live blog feeds and discuss the spectacle in our internal Campfire chat room as it unfolds. It’s a lot of fun but it usually involves a lot of reloading and copying and pasting too. So when I found out Tuesday morning that Ars Technica would be covering the Macworld keynote live on IRC, I had an idea: why not write a script to do all the hard work for us?

Ten minutes later the Campfire relay bot was born. I hooked up a Ruby IRC library with Marshmallow (an unofficial Campfire library that we use to display Subversion commits) to create a bot that repeats everything from Ars’ #mwsf channel to a room in our Campfire account. If you’re interested you can read the resulting transcript and download the bot (see the campfire_relay_bot.rb file for configuration instructions).

An under-the-hood look at the new Backpack

Sam Stephenson
Sam Stephenson wrote this on 23 comments

Backpack’s Pages tab has been completely rewritten in the new version. We moved nearly all of the application’s UI logic out of hand-written JavaScript files and into Ruby using RJS templates. This resulted in approximately 1600 fewer lines of application JS, and let us deliver pages with substantially less markup, since the edit states are now loaded on-demand instead of included in bulk with each page load.

Keep reading for more details on how we’ve improved Backpack’s internals, and for a look at several JavaScript libraries we’ve developed in the process.

Continued…