Colorized Svn Diffs in Sparrow

For a year now, I’ve had mail forwarded from my work email to my personal so that I could check mail in only once place. With some vacation on the way and not wanting to have thousands of messages keeping me from efficiently checking personal mail via my phone while computerless for a week, I decided to split the accounts back up. But I don’t want to have to check two accounts for mail on a daily basis, so I wanted to use a mail client. I had been using Sparrow to check mail on my phone and liked it quite a bit. This morning, I downloaded the app for my computer and also gave Thunderbird (which I used for years) another quick spin.

Well, I’ve become such a junkie for the Gmail way of doing things that using Thunderbird’s just not tenable. It feels like I’m using a TRS-80 or something, and the lack of threading by default (maybe you can get an extension to handle it) made me cringe. Sparrow provides a much nicer user experience and handles the threading beautifully, but it doesn’t do anything smart for colorizing svn diffs, which I’ve written about before as a problem with the default Gmail experience.

I decided to see if I could fix this, and it turns out that you can. Just go into /Applications/ on your Mac and add these lines to the bottom of the file:

[sourcecode lang=”css”]
ins { background-color: #cfc; text-decoration: none; }
del { background-color: #fcc; text-decoration: none; }

Then restart Sparrow. You’ll have lovely green and pinkish diff lines rather than impossible-to-read underlined text. Of course, I don’t imagine this’ll survive any software updates (or at least any that touch the css file — I’m not sure whether Sparrow does partial/differential updates or not), so chances are that this’d need to be reapplied after any update, hence my storing the fix here for my future reference.

UPDATE: I tried this fix with the free version of Sparrow. Since I like the software so much, I decided to help fund it by paying the $9.99 to support it. A nice side-benefit of paying is that the ads that appear in the free version to support it go away. Unfortunately, so does the ability to hack the CSS. When I modify the CSS in the paid version, it crashes on startup. I guess there’s some kind of checksumming going on or something. So for now, I’m back to using the free version with the svn diff colorization and an ad. I’m happy still to have supported development on the project but do wish I could use the premium version with my custom CSS.

Christmas in August

I’ve been eagerly anticipating for weeks now the arrival of a couple of work-related items. The first was a Timbuktu bag for my laptop. I had one of these years ago that Flock gave staff members, but it was entirely too small. It wouldn’t hold the oversize laptops I tended to get, and even if I had had a smaller laptop the thing could contain, there was precious little room for anything else in it. When I travel, I tend to have an assortment of books, cables, often a portable keyboard and stand for my laptop, etc. So the Flock bag never worked out for me.

The new bag, embroidered with the WordPress logo, could just about carry my whole trip’s worth of belongings. I requested a large backpack because I’ve been sporting a 17″ MacBook Pro for a couple of years now, and boy would this thing hold it. It’s more like the backpack wears me than like I wear it. My sense of this is exaggerated, of course, because I haven’t yet put anything in the bag, and it’s not at all broken in. I think it’ll be a great bag. (It was also stuffed with a couple of WordPress shirts and a mug.)

What makes the size all the more comical is that I have economized what I’ll be carrying around with me when I use the bag. Along with the bag, I also took delivery yesterday of a new 13″ MacBook Air, which is a good deal smaller than the 17″ MBP I’ve been lugging around. I feel like I’m working on an iPhone by comparison, and I feel as if I could tuck the thing inside one of the smaller pockets of my new bag (and lose it in there). I’ve also recently gotten a small Kindle, so that rather than porting around a behemoth laptop and several thick books, I’ve now got two slim devices and a whole bunch of empty space to carry around.

So far, I’m digging the laptop, though since I connect a bluetooth keyboard and mouse to it and use it on a stand as if it were a desktop machine, I’ve hardly taken advantage yet of its compactness. The thing is super fast, though, and so far it stays pretty cool (my other was a scorcher) and makes none of the worrisome sounds I had grown accustomed to. One of my favorite things is the MagicPad trackpad I got to go along with it. I’m still getting used to the various gestures for doing things, but once I get the appropriate muscle memory for them, I’m really going to like the way the trackpad changes my workflow. I may actually use some of the workflowy features of the new Lion OS whose cousins I’ve always dispensed with in earlier OSes. This already beats using the little bluetooth mouse I had been using, with its scroll ball that was perpetually broken for me.

Last, I recently got new business cards, which give me an odd sense of belonging (by which I mean that I feel a little out of my league here at Automattic, and having business cards and company equipment reassures me that there aren’t imminent plans to fire me). The business cards are nifty, turned sideways and featuring my ubiquitous snarly avatar and a QR code going to my gravatar profile on the back.

And that’s that. Christmas in August. Now back to work!


Shockingly, the company I now work for doesn’t much use email for person-to-person communication. I get many svn commit messages and various other automated notifications per day, but it’s rare to exchange email with a human being. We use irc and a special blog theme that makes it very easy to carry on threads in full view of everybody in the company. It’s great that we’re so open, but with something like 80 of these little blogs, some of which are pretty high-traffic, it can get a little overwhelming. Further, I have jabber notifications set up for many of the blogs, so that any time there’s a new post or a new comment, my instant messenger client bounces and beeps at me. When the blogs are really hopping, this absolutely kills my productivity because I’m a magpie who can’t leave the little alerts be for more than a couple of minutes.

Enter Concentrate, a neat little application that helps you do what its name suggests it might. In a nutshell, you define a thing you’d like to concentrate on (in my case “Development” and “Writing” so far) and then define a series of actions that can be performed or suppressed. You might tell it to deny you access to Facebook, for example, or you might tell it to open some app or another. Then you set a time limit, and while the timer’s ticking, you’re barred from doing the things that steal your attention.

I don’t post a lot on Twitter, and I’ve pared my contacts down pretty well, but my Twitter client does pop up alerts all the time. Paired with my IM alerts, these are very distracting. So now, when I want to spend an hour doing head-down development, I tell Concentrate that I want to concentrate on development. It shuts down my Twitter client and reminds me to disconnect from the IM network that delivers the many blog notifications I find so distracting. Then, once the allotted time has gone by, it fires my Twitter client back up and reminds me to reconnect to the IM network (I could have it just shut down the IM client, but then I lose recent history, which bugs me).

I do wish there were better ways of integrating with particular apps. For example, I might have it set a Skype status or change my irc nick to dissuade people from contacting me while I’m busy. But I suspect I can do that with AppleScript if it becomes a big enough deal to me (since Concentrate can run AppleScripts).

I’ve really struggled over the last few days with getting done some tasks that have required focused attention. This little application made my day today just terribly productive. If you’re a magpie like me, I recommend it.

Legible svn diffs in Gmail

For my day job, I now have to read many svn commit messages per day, typically via email (though a view via trac is just a click away). Gmail tries to be helpful by adding underline formatting to line additions and strikethrough formatting to removals, but the result is a nasty ball of unreadable spaghetti. I went in search of an extension that would fix this for me and found the Beanstalk SVN Diff Colorizer for Gmail, which is very nearly what I was after. I made one tiny addition of removing the text-decoration properties, and now I have beautifully legible commit emails in my gmail. I went from this:

The old, busted way to read svn diffs in Gmail.

to this:

The new, awesome way to view svn diffs in Gmail.


And here’s the script:

[sourcecode language=”javascript”]
// ==UserScript==
// @name SVN Diff Colorizer for GMail (based almost wholly on Beanstalk Diff Colorizer for Gmail –
// @namespace
// @description Adds colorization to SVN diffs received via Could be made to work with your webmail of choice, and probably some other SVN hosts, with minimal fuss.
// @author Matt Gillooly
// @include*
// @include*
// @include http://**
// @include https://**
// ==/UserScript==
(function() {
var css = "ins { background-color: #cfc; text-decoration: none; }nn del { background-color: #fcc; text-decoration: none; }";
if (typeof GM_addStyle != "undefined") {
} else if (typeof PRO_addStyle != "undefined") {
} else if (typeof addStyle != "undefined") {
} else {
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";

The only change I made was to tweak the styles so that only the coloration (and not the line-through or underline text formatting) is displayed.