Two Handy Sublime Text 2 Plugins

After using EditPlus for the better part of a decade, I made the switch to the totally awesome Sublime Text 2 text editor a few weeks back. One of the great things about Sublime is it’s support for plugins.

Two such plugins I’d like to recommend are SublimeBrackets and SublimeTagmatcher. Both improve how the highlighting of opening and closing items are handled.

By default, Sublime just underlines paired brackets. When you have a ton of code, this can be really hard to see. SublimeBrackets changes this to something more apparent:

Much better, right? I personally use the solid background green style.

SublimeTagmatcher does something similar but for HTML tags. When you have your cursor inside of an HTML tag, it will highlight both the current tag and it’s opening or closing counterpart. This is helpful for making sure you have the correct number of opening and closing tags.

New Computer Table From IKEA

Among the many things I bought from IKEA over the weekend was a new computer table. With some help from my dad who dropped by this evening, we assembled it and moved over my monitors and stuff. I think it looks quite good and it’s very sturdy. 🙂

Next up is a proper mouse pad to avoid wearing out the table (using a sheet of printer paper meanwhile) and a proper computer chair, probably a Herman Miller Aeron or something.

Translating Strings In WordPress Containing Multiple Placeholders

I really often see a common mistake made when translating strings in WordPress so I thought I’d write a blog post in order to shed more light on the issue.

But first, here’s a quick refresher on how to internationalize code in WordPress:

[php light=”true”]<?php _e( ‘Welcome to my blog!’, ‘my-plugin-text-domain’ ); ?>[/php]

For dynamic strings, it’d be something like this:

[php light=”true”]<?php printf(
__( ‘Welcome to my blog, %s!’, ‘my-plugin-text-domain’ ),
$name
); ?>[/php]

But what about when you have multiple variables to use in your string? A common mistake is to do something like this:

[php light=”true”]<?php printf(
__( ‘Welcome to my blog, %s! Today\’s date is %s.’, ‘my-plugin-text-domain’ ),
$name,
$date
); ?>[/php]

The issue with this is that you’re requiring the person’s name to always come before the date. If for internationalization reasons it needs to be in a different order, then it won’t work. You’ll end up with something like Today's date is Alex. Welcome to my blog, November 2nd!.

The solution is to use standard sprintf() argument swapping parameters:

[php light=”true”]<?php printf(
__( ‘Welcome to my blog, %1$s! Today\’s date is %2$s.’, ‘my-plugin-text-domain’ ),
$name,
$date
); ?>[/php]

Now translators are free to re-order the string to whatever makes the most sense for the language in question without having to worry the order of the variables.

For a more in-depth review of this, check out the WordPress Codex where many real world examples can be found.

Go Kart Racing In Budapest

I was in Budapest last week for the Automattic company meetup and during that meetup a bunch of us went out go karting. I took my GoPro HD Hero 1 with me and mounted it onto my go kart using a suction cup. The videos turned out pretty cool (although lighting was an issue) so I thought I’d post two of them here. 🙂

The Opening Race

I had gone to this place a few days before so I already knew the track and the karts but most of the people I was racing against where new to the track and karts, hence the speed differences.

The Championship Race

The people who posted the top 7 best lap times were put into a starting grid and had a final race off. The track’s narrow width made it nearly impossible to pass but it was still quite fun!

The final lap (starting at about 8:20) was a victory lap which is why I was goofing around and trying to powerslide. 🙂