/ blog

Topic: JavaScript

Variable Hoisting Puzzle

November 27, 2012, 12:28 pm

My colleague, Kyle, recently sent around an excellent article on execution contexts in JavaScript. I’m a big fan of esoteric JavaScript puzzles, so here’s one for you. Hint: the answer is in the above-linked article!

Mobile WebKit Optimizations & Tools

August 11, 2011, 8:11 pm

Last night I presented at the Mt View JavaScript Meetup (along with Glan). The following are my slide notes along with links to relevant resources. Get on the bus, ’cuz we’re goin’ to school!

Yet Another Explanation of JavaScript Closures

April 26, 2011, 1:11 pm

The closure is perhaps the most important and least understood concept in JavaScript. There are many excellent explanations already on the intertubes. To these, I humbly add mine.

HTML5 Client-side Storage. That’s hot.

March 20, 2011, 8:03 pm

I presented at the East Bay HTML5 Meetup last week. Good times! The following are my slides and demos.

I’m a bad tribe member.

September 26, 2010, 1:26 pm

On teh internetz, badges and ribbons are a signifier of tribal affiliation. I’ve taken part before, like during the height of the election crisis in Iran and in support of internet freedom in New Zealand. Today, I questioned whether linking to pages in Mozilla’s excellent Developer Center JavaScript documentation is the best way of boosting its Google juice. How dare I?!

CSS Fast Nav: Because (perception of) speed matters!

April 9, 2010, 9:04 pm

There must be 80 million tutorials for turning unordered lists into pretty navigation using CSS. This is not #80,000,001. Here, I focus on one detail that often gets overlooked: how to give the user the perception that her click had an immediate effect. In this post, I borrow a little inspiration from and show you how to give your site fast nav.

When is a global variable not a variable?

April 7, 2010, 1:37 pm

I’ve started reading Dmitry Soshnikov’s excellent series, ECMA-262-3 in detail. I’m only on chapter 2 and I’ve already learned a thing or two. I highly recommend it for anyone who wants to know JavaScript at a deep level.

Add an interactive legend to a MarkerManager managed Google Map

November 22, 2009, 11:22 am

There’s plenty of help out there for adding a legend to a Google Map. There are resources for working with MarkerManager as well. I can’t believe this is new ground, but there didn’t seem to be anything related to getting an interactive legend to play nice with MarkerManager. Now there is!

Stupid WebKit Tricks

July 19, 2009, 7:19 pm

With apologies to David Letterman’s Stupid Human Tricks segment, I presented a session at Barcamp Auckland (BCA3) on some WebKit-specific features you can leverage in web applications for iPhone, Android, and the Palm Pre. This is my synopsis, plus a bonus trick I didn’t present at the (un)conference!

Animating your iPhone web application

May 29, 2009, 6:18 pm

Recently, Rebecca Murphey asked on Twitter why she was seeing choppy animation of CSS transitions in her iPhone web application. Initially, I had the same experience, but through some experimentation came to find the smoothness I craved.

Dude. Mikeyy can’t even spell his own name.

April 12, 2009, 5:51 am

Yeah, I got p0wnd by the Mikeyy Worm on Twitter. It’s a simple JavaScript injection attack. You get it by visiting an infected person’s profile with JavaScript turned on in your web browser. Here’s how to stop the madness.

Sending Growl notifications from Dashboard widgets

March 14, 2009, 3:14 pm

Recently, on Dashboard-Dev, Aaron Vizzini asked how to integrate Growl notifications into Dashboard widgets. I just did this in Hurler and, so I am happy to document the process here.

jQuery 1.3: Sweet upgrade, but can we use it?

January 14, 2009, 2:14 pm

The jQuery team has outdone themselves in many ways with version 1.3 of the world’s best JavaScript library. But are they leaving real-world web development behind?

V8: neither all that nor a bag of chips

September 11, 2008, 11:09 pm

I just got an interesting result comparing Google Chrome to the latest WebKit nightly build. WebKit was nearly twice as fast as Chrome at completing the little suite of JavaScript unit tests I keep here at work. Is V8—Chrome’s much-touted JavaScript engine—neither all that nor a bag of chips?

Playing to a browser’s strengths: Simple Templates 1.1

September 6, 2008, 11:11 pm

In the 3 days since I first published Simple Templates, I have released 1 bug fix and 1 minor upgrade. It’s a much better plugin than it was a couple of days ago. I guess this is why they say “Release early. Release often.”

Introducing jQuery Simple Templates

September 3, 2008, 9:03 pm

Overall, I love jQuery. One thing I have missed from my Prototype days was simple, built-in templating. Introducing jQuery Simple Templates.

Coda 1.5 is the bee’s knees

August 27, 2008, 1:11 pm

A long time ago, in a country far, far away, I wrote a blog post where I called skEdit The (Mostly) Perfect Text Editor. Coda, while itself not perfect, is even better.

Numerical array sorting in JavaScript

August 26, 2008, 8:26 pm

In these troubled times, it can be hard to know whom to trust. In looking for a numerical sort function, the first two articles I found both recommended the same syntax. Both of them were wrong.

Widget JavaScript, the Un-series: Part 0 (Namespacing and the Module Pattern)

May 13, 2008, 3:45 pm

I’m not big on series of blog posts. Others have done it successfully, but personally I’ve promised this kind of thing before and not delivered. So, I’m not making any promises that this series will get past Part 0, but please know I have the best of intentions. If all goes as hoped, over the next however-many posts I will provide a few useful JavaScript code snippets that Dashboard widget authors can take and easily adapt to their own needs. This is based on my experience authoring nearly 20 widgets over the last 3 years. As you can imagine, some patterns have emerged. In this pre-series post, I will discuss a couple of concepts important to understanding my examples (you know, if I get around to posting them): namespacing and the module pattern.

innerHTML versus the DOM: Can’t we all just get along?

April 19, 2008, 11:11 pm

Having tested the relative speed of innerHTML versus DOM node replacement myself, I read with interest When innerHTML isn’t Fast Enough. I have put together a test of my previous 2 techniques plus one inspired by that article.

Radiant JavaScript Singletons Freelance Down Under

February 28, 2008, 11:11 pm

It’s summer down under and I’ve spent the last 2 weeks on a self-styled “working holiday,” freelancing doing some fun work with Radiant CMS and rediscovering the beauty of JavaScript prototypes. I’ve also managed to relax a bit, going to the beach and swimming with my beautiful daughters. Not a bad way to spend some time off work.

Handling Hash

February 12, 2008, 2:12 pm

No, I’m not talking about drug smuggling. I’m talking about the inconsistencies in how The Big 3 web browsers deal with window.location.hash.

The need for speed: innerHTML versus DOM manipulation

July 3, 2007, 9:21 pm

At work, I’ve been tackling some fairly sophisticated JavaScript DOM manipulation scenarios. As such, I’ve started to run up against the limitations of my long-used technique of stuffing loads of HTML as a string into some element’s innerHTML property. Specifically, when inserting very long strings containing complex HTML, there can be a troublesome delay between when JavaScript thinks it’s done inserting the elements and when the elements are actually available for further manipulation.

JavaScript Unit Testing

June 10, 2007, 6:10 am

I’ve started working on version 1.0 of my PHP function reference widget for Mac OS X Dashboard. At work, we cover a lot of our code with unit, functional, and Selenium tests. I decided to drink the juice and do the same in the context of widget development.

I changed my default web browser

February 9, 2007, 7:07 am

Not that anyone but me really cares.