SPECIAL! Pre-Order my book Smashing Node.JS on Amazon today!
Show Posts
← Back to homepage

With the announcement of SPDY support by Twitter, I thought it would be cool to visualize how this extends to the rest of the web as I browse it.

I developed a Chrome extension you can install to visualize SPDY support in your address bar. Source on Github.

Install Chrome Extension

For those who haven’t heard of SPDY, it’s a new protocol being developed by Google to transport the existing HTTP protocol more efficiently (up to 50% faster). You can read more details in the official Chromium page.

Read more

spot is a tiny file search utility written in Bash, meant to be fast and have very straightforward usage.

For example, it considers all your arguments to be the search phrase without needing quotes:

And it turns on case-sensitive search if you include an uppercase letter:

The aim of the utility is to be useful and straightforward for the majority of searches. Hence, its options will always stay limited and the codebase brief. You’re also encouraged to fork it and modify it to your liking!

Go to the GitHub project page for download, examples and the up-to-date project.

I created a tiny yet useful shell script that opens a browser window on the GitHub “new pull request” interface.

Add the following to your bash profile and run it as pr. It will detect the user, repository and branch automatically.

function pr () {
  local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
  local branch=`git name-rev --name-only HEAD`
  echo "... creating pull request for branch \"$branch\" in \"$repo\""
  open https://github.com/$repo/pull/new/$branch
}

export -f pr

Socket.IO 0.9.0

Socket.IO 0.9.0 has been released, and it’s packed with bug fixes and performance/stability enhancements on both the server and client codebases.

Please refer to the mailing list announcement thread for a detailed changelog.

This also puts us in the last sprint to Socket.IO 1.0! Stay tuned in the coming weeks for the appropriate announcement.

Up 0.1.5

When you use the up CLI for zero-downtime HTTP reloads, you can already leverage --watch to reload your server while developing based on configuration file changes.

However, sometimes things change that are not captured as easily, like configuration files, caches, environment, etc. For this, you can now press ctrl + R in the comfort of your terminal to trigger a quick reload.

 ∞ hello-world (master) up server.js
  up-cli starting cluster with 1 workers on port 3000
  up-cli `kill -s SIGUSR2 76715` or ctrl + r to load new code
  up spawning 1 workers from master 76715
  up worker 76716 created
  up worker 76716 listening on port 60995
  up-cli ctrl + r detected - reloading
  up reloading - spawning 1 new workers
  up spawning 1 workers from master 76715
  up worker 76718 created
  up worker 76718 listening on port 60997
  up worker 76718 spawned - removing old workers
  up telling worker 76716 to exit in 500ms
  up worker 76716 exited

WebSocket.IO 0.1.6, Distribute 0.1.4

Maintenance releases for these two modules.

The Node.JS websocket server with support for all protocols and parsers gets a maintenance fix for 0.4. WebSocket.IO powers the upcoming Socket.IO realtime core, Engine.IO.

Distribute 0.1.4 adds a guard to aids with the debuggability of a “double-callback” situation that can result in calling next twice within a middleware.

I decided to put together a little list of tips and tricks related to NPM you might not know about, that come from my experience working with it daily, in both production and development.

Read more

With Express 3.0 the view functionality is slimming down even further. Today res.render not only integrates with template engines but also introduces the concept of layouts.

The layout option and functionality is being removed in favor of more flexible alternatives that template engines can offer without Express solving it for them.

Jade saw the introduction of the extends and block citizens. A template now:

  • Expresses what layout it belongs to, which is a more natural fit in web applications.
  • Declares what blocks it extends, which means a template can add markup to more than one part of the layout.
// my-template.jade
extends my-layout

block head
  script(src="myfile.js")

block content
  h1 My page
// my-layout.jade
doctype 5
html
  head
    title My title
    block head
  body
    #content
      block content

In addition to “filling” a certain gap in the template, you can leverage the append and prepend keywords to have different templates modify others incrementally.

This simplification is a win for everyone. res.render now just focuses on providing the glue to other modules, your routes will simplify, and understanding what a template ultimately renders is easier.

About Guillermo Rauch:

CTO and co-founder of LearnBoost, developer, open source enthusiast, blogger.