Recent Code News


I wrote a very thorough comment in response to the rather (unfortunately) ignorant and inflammatory blog post on DailyJS titled Static Site Generators for Yeoman, but it seems to have mysteriously disappeared. I didn’t intentionally delete it, at least.

Either way, here’s my original comment, in case you may have missed it.


“If you’re gonna hate, hate with some consistency.” (source)

Earlier today, one of my coworkers was contributing to a cool new JavaScript lib, and complained that while he loves contributing to open source projects (who doesn’t, right?) he finds it annoying to read JavaScript code without semicolons.

Not just that, but he mentioned that he finds it amusing when, amidst hundreds of lines of otherwise pristine semicolon-less code, there is a single line that starts with a semicolon.

So I tweeted about it, then someone tweeted back and I decided to work up an example.

Then I decided to write a blog post. Although that’s mostly because I have a lot of work to do, and I’m an expert procrastinator.


Unless you've used another functional programming language such as ML or Haskell, concepts such as partial application and currying in JavaScript may be foreign to you. That being said, once you understand these concepts, you can put them to use in your own code.


Recently, Miller Medeiros wrote a blog post called Node.js, Ant, Grunt and other build tools where he outlined some of his concerns about JavaScript build tools, focusing specifically on grunt, the task-based JavaScript build tool I’ve been developing.

Instead of posting a super-long comment on his blog, I figured I’d respond to his comments here.


You know the new Apple Retina MacBook Pro laptop? The one with the super-high resolution display? Well, I got one last week, and I spent all weekend updating my dotfiles to work with OS X 10.8 (Mountain Lion). And after a lot of wrangling with XCode, I finally managed to get everything working. Well, almost everything.

While using Gyazo, I’ve encountered one particularly annoying “Retina” related issue. I posted an article a few years ago about running Gyazo on your own server, and ever since then I’ve been running Gyazo without a problem. The first time I used it on the new laptop, however, I noticed that something odd was happening: every Gyazo screengrab on the new Retina screen was about twice as big as I expected.

Note that while this article addresses an issue within the context of using Gyazo, because it’s more of a general OS X issue, the solution presented herein can be useful in similar scenarios.


I’m not sure where or when it happened, but at some point the JavaScript community decided that multiple, individual var statements were superfluous, instead opting for a single, combined var statement with a comma-separated list of variable declarations and assignments whenever possible.

Just in case you don’t know what I mean, I’ll illustrate:

// Single, combined var statement.
var foo = 1,
    bar = 2;

// Multiple, individual var statements.
var foo = 1;
var bar = 2;

I’ve asked a number of talented JavaScript programmers why they prefer a single, combined var statement with multiple declarations and assignments to multiple, individual var statements, and the only responses I’ve been able to get seem entirely subjective:

  1. Multiple var statements are superfluous.
  2. Multiple var statements are noobish.
  3. Combined var statements look better.

While I can’t argue with the last point, in JavaScript, multiple var statements aren’t superfluous and they aren’t noobish. They reduce the effort it takes to maintain code.


For the last few months, I’ve been working hard on grunt, a task-based command line build tool for JavaScript projects that facilitates creating new projects and makes performing repetitive but necessary tasks such as linting, unit testing, concatenating and minifying files (among other things) trivial.

Earlier today, I posted an article to the Bocoup Weblog introducing grunt, explaining why I created grunt (to make my life easier), how it was created (in Node.js JavaScript), how you’d go about using it (by typing grunt on the command line), who is already using it (the jQuery project for starters), and what its future looks like.

In addition, I’ll be in Phoenix, AZ next week for JSConf and will be talking about grunt for 15 minutes next Monday, on the “Twitter Track.” So if you want to learn more about how grunt works, first read my introducing grunt article. After you’ve done that, if you’re going to be at JSConf, come to my talk. And don’t be afraid to find me and ask me all about it!


I’ve been playing Battlefield 3 recently, but the new Battlelog service has a few issues surrounding refreshing and joining servers that are driving me crazy.

I’ve attempted to address these issues with a new userscript called Battlelog Hacks, so check it out and let me know what you think!


Earlier this month, I spoke at the Boston jQuery Conference, where my talk on “Plugin Authoring Best Practices” was well received. It went so well that I’m going to be giving it talk again, but this time online, at the jQuery Summit!

Like last year, I’ll be giving two talks. On the first day, I’ll be giving the aforementioned Plugin talk. On the second day, I’ll be giving a talk on JavaScript Unit Testing with QUnit.

Continue on for more information about my talks and a 20% off coupon code!


I’m very excited to be speaking at this year’s Boston jQuery Conference. I’ll be giving a talk entitled “Plugin Authoring Best Practices,” so be sure to sign up for the conference, come to my talk, and say hello!

Also, the day before the conference, I’m going to be giving our full-day Bocoup Beginner jQuery Training. If you’re new to jQuery, this training will help get you prepared for all the great talks that you’ll see over the weekend. The training is a good value, with all proceeds benefit the jQuery project.


I recently attended the jQuery Bay Area Conference, which was held at the Microsoft Silicon Valley Campus Conference Center in Mountain View, California. I decided to go not only from a personal “want to hang out with cool people” perspective, because I know many people who are active in the jQuery community, but also from a “Director of Training at Bocoup” perspective. The former is cool because it’s always nice to interact directly (ie. drink beers) with people with whom your only typical interaction is IM or IRC. The latter is cool because on the day before the conference, Bocoup donated a full day of Beginner jQuery training to a very appreciative group of attendees, with all proceeds going directly to the jQuery Project.


Just over a year ago, I blogged that jQuery BBQ was going into version 7 of the popular open source Drupal CMS, as a crucial part of the overlay module.

The overlay module allows the Drupal admin interface to appear seamlessly, as a modal window, on top of the current page, while maintaining that page’s context. This was, of course, a great idea, and one that jQuery BBQ made easy, with its built-in cross browser HTML5 onhashchange event and fragment management functions.

And now that Drupal 7 has finally launched, jQuery BBQ provides back button support in over 20,340 sites, not to mention the sites where it was already being used, of course.

Pretty sweet, huh?


In some of my recent work on a much-needed update to JavaScript Debug, I noticed a few “interesting quirks” with try…catch in Internet Explorer 6-8, so I decided to write an article with my observations.

As a change of pace, I decided to post this article to the Bocoup weblog. It’s actually my first article over there, so you should give it a read, and let me know what you think!

Read more about The “catch” with try…catch

In related news, progress on JavaScript Debug has been moving steadily forward, and I hope to have a new version out within a few weeks (which probably means a few months, given my current workload). Either way, stay tuned, because good things are in the works!


In case you hadn’t noticed, I’m a bit of a stickler for terminology. So, after hearing the popular, yet misleading, JavaScript term “self-executing anonymous function” (or self-invoked anonymous function) one too many times, I’ve finally decided to organize my thoughts into an article.

In addition to providing some very thorough information about how this pattern actually works, I’ve actually made a recommendation on what we should call it, moving forward. Also, If you want to skip ahead, you can just check out some actual Immediately-Invoked Function Expressions, but I recommend reading the entire article.


In case you missed my previous blog post, I’m speaking at the upcoming jQuery Summit, a two-day online conference taking place on November 16th and 17th. I’ll be giving two talks, “Idiomatic jQuery” and “jQuery Pluginization” (one each day). In addition to my presentations, there will also be talks by a number of other well-known jQuery community members.

In addition, I promised that a few lucky winners would win a ticket for either the Designer or Developer tracks. So, with a little help from Brendan Eich, Ronald Fisher and Frank Yates, and without further ado…

More Recent Code News