Suppose you read this book only once. It might be very good reading. But what would happen you if read it twice, three times, four times, or more? In the beginner's mind there is no thought, "I have attained something."

Clouds surround Shasta

CommonJS Modules Make Brittle Singletons

We occasionally rely on node's module caching to share a single instance throughout a full-stack javascript project. This strategy breaks more than we'd like.

If modules butternut and delicata both require('squash'), they'll usually get the same (think ===) squash instance. But not always.

Here are a couple times it hasn't worked out.

Speed up your Responsive App with Node and Varnish

Conversations about responsive design often focus on the browser: media queries, grids, and the like, but there's more! Creating a great experience on all sorts of consumer-grade doo-dads demands some work on the server.

On Good Eggs, shoppers with full-sized computers don't want all their grocery aisles hidden behind a collapsible menu. The markup to generate the desktop navigation is different enough from the mobile navigation that using media queries would be a stretch (heh, get it?). By trimming the more complicated desktop markup from the mobile response, we save precious page weight for a faster load time.

Let's take a journey along the request-response cycle to illustrate how we send different responses to different devices while maximizing cache hits:

Flow Diagram


Lighting can transform a space. Nice lighting makes me smile. Jean Pelle's bubble chandeliers are nice lights. She dreamed them up around 2008 and generously shared the plans, so I made one.

Loading Scripts in the Critical Path: A Commerce Case Study

Starting javascript on DOMContentLoaded, a pattern baked into or recommended by many frameworks, defers some work that could be done earlier. There aren't many examples of what can be done early, or how to wire it up. Here's how we did it on the Good Eggs mobile site.

A Better Food System, Phone Sized

We built a mobile site at Good Eggs. Check it out by visiting on your phone. In case you're not on a phone now, it looks kinda like this:


Hopefully we made it a little easier to buy food from foodmakers living their dreams. We had a good time making it, and we're chronicling the process with a series of blog posts. Follow along for the full story.

When I dined with Mr. Gladstone, I felt as though he was the smartest man in England. But when I dined with Mr. Disraeli, I felt as though I was the smartest woman in England.

Automobile ♡ Smartphone

Put an iPhone in the dash of an old Pathfinder on the cheap.

Audio wiring diagram I should bike everywhere, I know, but sometimes I give in and drive; usually when I'm going far. A good audio book gets me lost. A good offline GPS gets me really lost. Any newish phone can do both with ease.

PG and the Epicureans

Don't fear god,
Don't worry about death;
What is good is easy to get, and
What is terrible is easy to endure

Epicurus, 3XX BC

Don't ignore your dreams;
Don't work too much;
Say what you think;
Cultivate friendships;
Be happy

Paul Graham, 2012

Stoicism is making a bit of a comeback in tech circles. Folks find

Fibrous on Harmony Generators? Impossible

A good Friday afternoon chat about asynchronous programming models left me wondering if the fibrous API could be implemented on top of ES6 generators. Generators are baked in to Node 0.11, Chrome 19, and Firefox. A port would be a big boost to interoperability. Traceur can even transform generator based code into a giant state machine that runs on all of today's environments.

At first the port looked promising. Wikipedia claimed that general coroutines could be built on generators, and many folks have done just that. After a little noodling I'm pretty sure it can't be done. In a Harmony environment a function can only suspend execution at yield expressions and yield expressions can only appear in generator functions. A yield expression cannot be wrapped up behind a fibrous sync or wait.

Ids in Mongoose, JSON, and Backbone

Mongoose adds id sugar on top the default _id document attribute. Backbone has similar sugar, but the types don't line up. Pushing bits between the two with a customary JSON document adds a third representation.

If you find yourself typing when you really needed new ObjectID(vegetable.toJSON()._id) this fancy chart might help:

How to Remove a Property from a Mongoose.js Schema

This should be simple, but Mongoose really clings to data in existing documents. I'll walk through all the ways I wanted it to work that failed. We'll remove an organic flag from a toy Food model so we can replace it with Bittman's dream label. If you just came for the solution, I arrived at:

  {$unset: {organic: true}},
  {multi: true, safe: true}

Mini Golf

Just three holes. Aim with with mouse. Click to putt. Force ∝ distance from mouse to ball. Sounds and title image plundered from the internet.


The turtle shaped rock is the only functioning dock.