Rails tip: Automatically link a controller’s stylesheet
This is a simple application helper I wrote to reduce the tediousness of linking stylesheets for each controller. It will link the controller’s stylesheet (located at public/stylesheets/[controller_name].css) if it exists but it won’t complain if it doesn’t. I use it in pretty much every Rails project to keep things organized. It’s super simple to set up.
Simply add this to your application helper (located at app/helpers/application_helper.rb):
def controller_stylesheet_link_tag
stylesheet = "#{params[:controller]}.css"
if File.exists?(File.join(Rails.public_path, 'stylesheets', stylesheet))
stylesheet_link_tag stylesheet
end
end
…and put this in your application layout (located at app/views/layouts/application.html.erb):
<%= controller_stylesheet_link_tag %>
Easter eggs
I’ve always been a fan of Easter eggs on sites, for example, those that utilize the Konami code and, more importantly, those that involve rainbows and unicorns. This blog has a tiny, yet…enthusiastic Easter egg. See if you can’t find it.
Hint: It quite possibly might have something to do with attempting to find things that do not exist.
Feel free to share any fantastically awesome Easter eggs that we (by we, I mean I (see, this blog is pretty new and I don’t have the largest reader base (but that’s okay because you (in this case, I) have to start somewhere (am I right?)))) might not know about.
Norway — Beach House
I love, love, love this song. Three reasons why:
- The shoegaze-y lo-fi/detuned guitar is awesome (My Bloody Valentine anyone?)
- At present, the lyrics are creepily relevant
- Norway is awesome
The cure for a strange Flash/Firefox/Spaces bug
I’ve run into a strange problem where Flash confuses a left mouse click for a right click. This seems to happen when Flash has the focus in Firefox and you switch to another space via Spaces in Mac OS X. This is very, very frustrating.
WTF?

The cure
After some light research, it seems that there is currently no official fix for this problem (I’m not sure if it’s a Firefox, Flash, or Spaces bug). However, I’ve discovered a temporary fix that at least eliminates the need to restart Firefox. To fix, simply press the modifier of your choice (ctrl, option, command, or shift) and Flash behaves.
Here’s to hoping the HTML 5 video tag becomes universally supported and implemented soon.
How to install the “tree” command on Mac OS X
Many of you have seen the tree command being used on a few Ruby on Rails and Git screencasts such as the ones on Gitcasts. The tree package is available on most package managers such as MacPorts and Fink for Mac OS X, however it’s nice to roll your own. This tutorial shows you how.
Tree provides a very useful way via command line to quickly display a graphical overview of a directory’s contents.

Installation instructions
To install, download the source code and extract the tarball like so:
curl -O ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz
tar xzvf tree-1.5.3.tgz
cd tree-1.5.3/
ls -al
Now you have to change Makefile to match your environment. If you’re using Linux, you can probably skip this step. If not, simply uncomment the lines for your operating system and comment out all the others. For example, if you’re using Mac OS X, do the following:
- Comment out the following lines so they look like this:
# Linux defaults:
#CFLAGS=-ggdb -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
#CFLAGS=-O2 -Wall -fomit-frame-pointer -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
#LDFLAGS=-s - Uncomment these lines, like so:
# Uncomment for OS X:
CC=cc
CFLAGS=-O2 -Wall -fomit-frame-pointer -no-cpp-precomp
LDFLAGS=
XOBJS=strverscmp.o
Now you can make and install (if you get any errors on the following commands, you probably didn’t edit Makefile correctly):
make
sudo make install
Finally, you should be able to try it out:
# Display a tree for the current working directory
tree
# ...or append whatever directory you want
tree /whatever/directory/you/want/
Tada!
That’s it! Now you can get a quick overview of what a directory contains in an easy to understand format. Let me know if you have any problems or questions.
Top 10 albums of 2009
I really got into music in 2009—moreso than any other year. Some really awesome music was released. Out of all the albums (iTunes says 45) I listened to in 2009, here are my personal favorites.
While you’re reading, listen to the songs that I feel will best introduce you to these albums. Ready. Set. Go!
10. Bibio - Ambivalence Avenue (Buy on Amazon)
What I really like about this album is it’s variation. Every song is from a different planet, it seems. This is a fun, funky album.
9. Peter Bjorn and John - Living Thing (Buy on Amazon)
This album puts me in an interesting mood. I like it.
What sparked my initial interest was the album artwork. The idea is clever and the colors are brilliant. Check it out in high resolution! It’s the work of Swedish artist Thomas Broome.
Peter Bjorn & John are a band from Sweden. I’ve really gotten into music from Nordic countries lately. There’s a lot of really great music coming from that area of the globe (now that I think of it, 20% of this list is from that area).
Also, I totally just realized that the acronym for Peter Bjorn & John is PB&J. P-B-&-motherfucking-J!
8. Volcano Choir - Unmap (Buy on Amazon)
Volcano Choir is the collaboration of Justin Vernon (the guy from Bon Iver) and Collections of Colonies of Bees (who I had previously not known existed).
This is a great album to listen to this winter. Grab it and listen while drinking hot chocolate or, better yet, a fine scotch by a fire.
Listeners of Bon Iver, this album is a little more experimental than anything on the Bon Iver records.
7. Girls - Album (Buy on Amazon)
This is a record about love and life (especially that of a teenager/young adult). It’s very honest. The lyrics pull you in and make you feel what the singer feels.
Hellhole Ratrace is a powerful song. “I don’t want to cry my whole life through. I want to do some laughing too. Some come on, […] and laugh with me.” It’s a song about enjoying life and it’s definitely one of my favorites of the year.
6. Neon Indian - Psychic Chasms (Buy on Amazon)
I listened to this a lot at the end of summer. It was perfect for that time of year. It’s a fun record that has an 80s analog sound. Actually, the sound reminds me of those terrible “Don’t do drugs” videos from the 80s that high school teachers show their students. Seriously, those were awful, but this definitely isn’t.
5. The Whitest Boy Alive - Rules (Buy on Amazon)
Holy Rhodes, Batman! Yep, Rhodes. If this album was beef stew, the Rhodes piano would be the beef. Without it, it’s just stew (but that doesn’t make it any less awesome).
I’ve always admired the ability of Erlend Øye (better known as a member of Kings of Convenience) to make beautifully simple music. This is music stripped down to the very basic essentials. It shows us that you don’t need complicated guitar solos and a 25 piece drum kit to make good music. Sometimes, all you want are some meat and potatoes.
4. Dirty Projectors - Bitte Orca (Buy on Amazon)
This album is unique. And in a world where being unique is absolutely imperative, this album thrives. It’s a feast for your ears. The girls’ background vocals continually impress me. They sing like angels, I tell ya.
This album screams quality. Every last detail, the melodies, rhythm, harmonization has been precisely tuned to delight your ears.
3. Phoenix - Wolfgang Amadeus Phoenix (Buy on Amazon)
I can’t pick a favorite song from this album. I’ve never been in a mood where I didn’t want to listen to every one of these songs. They are addictive.
Wolfgang Amadeus Phoenix makes me want to dance. It makes me want to drive with the windows down on a summer day and sip on some wine at a café in Paris on a cool night. It makes me want to hang out with friends and enjoy life. This is an album for the times in your life that you feel alive.
2. Animal Collective - Merriweather Post Pavilion (Buy on Amazon)
Music is unlike any other media. The emotions I feel when I listen to music are stronger than when I watch a movie or look at a photograph or painting. The feelings are more enduring too. When I listen to music months or even years later, the feelings are just as strong.
This album makes me feel things I didn’t know I could feel. It has made me love music more than I ever have and for that, I can’t recommend Merriweather Post Pavilion enough.
1. Grizzly Bear - Veckatimest (Buy on Amazon)
Here we are. Number one. Grizzly Bear has made a masterpiece here. Veckatimest is a smörgåsbord. It has the beautifully crafted subtleties and harmonies that made me love Bitte Orca, and, like Merriweather Post Pavilion, it makes me feel things I didn’t know I could feel. It’s a solid album that has much to be admired and enjoyed.
Two Weeks is easily the best song of the year. I first listened to it via Youtube from a live performance on Later with Jools Holland and was immediately blown away. Check out While You Wait For The Others as well.
Veckatimest is a beautiful album that deserves every bit of attention it’s received. Grab it, listen to it, then come back here and tell me what you think.
A better way to type
I switched to the Dvorak keyboard layout approximately three months ago. For those of you who don’t know what it is, this will inform you. To summarize, the QWERTY keyboard that most people use today was originally designed to prevent the hammers from colliding in early typewriters. Now that we all use computers to type, QWERTY is no longer necessary. It’s an outdated and inefficient method of typing.
Dvorak solves this problem. It was designed to make typing easier and faster by placing frequently used keys in easier to reach positions. For example, the most used keys are on the home row. This means you can type the majority of letters (something like 70%) without even moving your fingers. You can begin to see the benefits: typing becomes faster and more comfortable. Sound good? I agree.

Switching to Dvorak
Switching to Dvorak is very easy. If you’re using Mac OS X, Windows, or most distributions of UNIX/BSD/Linux, it’s already built into your computer. A quick Google search will show you how to enable and start using it.
Before you switch, listen up. There are a few caveats, mostly relating to Dvorak not being the universal standard. For example, when typing on another person’s computer with a QWERTY keyboard, a Dvorak typist will “hunt and peck.” It can be embarrassing. If you frequently use others’ computers, say you work in a computer support type of job, Dvorak may not be for you. I frequently use my girlfriend’s (who uses a QWERTY keyboard) computer and vice versa. We simply learned the keyboard shortcut both on my Mac and on her PC to quickly switch between layouts. Problem solved.
I tried to think of another reason why some people shouldn’t use Dvorak but I can’t. I don’t care that it’s not the standard, I don’t care that it has failed to be universally adopted, and I really don’t care if it ever is universally adopted. It’s simply the best way to type. The benefits far outweigh the inconveniences.
Having used QWERTY nearly every day for more than ten years, switching to Dvorak was daunting. I was hesitant to relearn one of my most used skills. Having said that, it took only a few days (on a weekend) to reach a reasonable typing speed. Within a few weeks, typing became second nature once again.
It’s been three months now and my typing speed has never been faster nor more comfortable. I can type longer without getting fatigued. My hands no longer hurt after a long day of typing. The process of learning Dvorak was challenging but it was a small and very brief price to pay for a lifetime of easier and more comfortable typing.
Edit: I just found DVzine.org, an online comic that teaches you more about Dvorak. Awesome!
What Mustard teaches us
Stories sell. Let me explain.
First, watch this video:
Unimpressed? I was too. I overheard this playing from my girlfriend’s computer speakers this morning while I was ironing my shirt. My initial reaction went something like this, “Wow, it’s a raspy-voiced cover of a mediocre Radiohead song” (granted, “mediocre Radiohead song” means it’s still a really good song). Then she explained that the guy is actually a bum who went on a radio show for a bit they were doing on bums. During the show, they discovered he plays the guitar, so they handed him a guitar and he blew everyone away.
All of the sudden, the video became incredibly more interesting. It’s still the same video but now it’s interesting. Why? The guy has a good story.
I shared the video on Twitter and Facebook as soon as I got to work this morning. Chances are you will too. People love being the first to show their friends something interesting. Sharing things with friends is really rewarding. I show my friends new music all the time for the same reason.
It’s not hard to see how valuable storytelling can be from a marketing perspective. A good story gives your customers a reason to tell their friends about you.
Note: Gary Vaynerchuk expands more on the importance of storytelling in marketing in his new book Crush It!. I’ve read it and I highly recommend checking it out.
The perfect iTunes view for large libraries
While iTunes 9 provides us with three views, it takes a little tweaking to get a view suitable for large libraries. In order to understand why it is indeed the best view, I have to first explain why the other views suck.
Cover Flow
Cover Flow is really slick. It looks amazing, image rendering is crisp, and it looks like the sweet ass jukeboxes we all love (everybody needs a little retro action in their lives). However, every time you open iTunes, the album artwork is loaded into memory and it takes a while. When this is happening, things get a little choppy. Also, it takes a long time to scroll through a long list of albums sideways.
Cover Flow is purty

Grid view
Grid view is great for people who have many full albums as opposed to Miley Cyrus and Katy Perry singles (you know who you are).
I fell in love with grid view at first. It displays albums in relatively little screen space. The problem is it’s impossible to look at five columns of album artwork at once while scrolling. Unless you’re Kim Peak and can read both pages in a book at the same time, you have to move your eyes back and forth and back and forth and back, etc. It gets really annoying and I frequently find myself scrolling past the album I’m trying to find.
You may be thinking, “just use the search box,” but the problem is I don’t always remember the name of the album I’m trying to find, especially if I’ve recently added it to my library. Hey, give me some slack. I listen to a lot of music!
Grid view

List view
In the early days of iTunes, list view was the only view. One problem with it is there is so much redundant information—namely the artist and album names. Look at that! TV On The Radio, TV On The Radio, TV On The Radio, TV On The Radio, TV On The Radio, TV On The Radio. It’s not necessary. As you can see, a lot of screen space is wasted.
List view

Wouldn’t it be great to separate the stuff that’s different for each song from the stuff that’s the same? I agree. Let’s make it happen!
Creating the perfect iTunes view
Newer versions of iTunes allow you to add an artwork column (click the little arrow to the left of the song name column). This gets us a little closer to the perfect view. On the left is the album artwork with the artist and album name below it. Sweet, now we can get rid of the redundant columns on the right.
List view with artwork column

You can hide the artist and album columns by right clicking the column bar and deselecting them. Gotcha! If you hide both the artist and album a problem arises—it no longer sorts by artist. Now, it sorts by song. What a mess. Unfortunately, you have to keep either the artist or album column. Let’s keep the album column.
Here’s a trick to keep things even more organized. Click the album column repeatedly to scroll through album sorting options: Album, Album by Artist, or Album by Year. Pick one of those. I prefer Album by Year because it sorts by artist then cronologically by album year. It makes the most sense to me. You may disagree and choose to use Album by Artist.
List view with the artist column removed

The only problem now is it takes forever to scroll through a large library. iTunes 9 brought a change to the artist/album/genre browser. Now it’s a lot more customizable (View > Column Browser). With the space we gained from removing the artist column we can now add the artist browser on the left, allowing us to quickly select individual artists. Bingo!
The perfect iTunes view

This configuration gives us the most information (with as little redundancy as iTunes 9 will allow) in a small amount of space while keeping it organized.
Web application ideas, part 2
I’ve decided that I’m going to keep the other web app idea to myself for now. I need to give it a little more thought and iron a few kinks out but rest assured it’s going to be good. I’m going to focus all of my spare time in the next few weeks to the development of a prototype. Stay posted!
Update: This idea has turned into Follow.fm. It’s still in development and will be released soon.










