You are reading Ben Weaver's website.

Use the Google Closure Service With Node.js

Here's a short Node.js method for compressing javascript with Google's Closure Compiler Service. Besides being practical, it's a good example of sending a POST request using Node's http module.

Decode multiple JSON objects from one file

Python's json.loads only decodes one JSON object. This example shows how raw_decode can be used to load multiple JSON values from the same buffer.

Make a custom jQuery pseudo-selector

Jquery can be extended with custom pseudo-selectors. Using pseudo-selectors improves code readability and avoids repetition. This example shows how to make a pseudo-selector called :named.

Unselectable Text

Making text unselectable is useful for creating certain javascript UI widgets. This is a cross-browser method for preventing text selection using an unselectable="on" element attribute.

Non-blocking network I/O

I wrote a couple of toy "hello world" web servers to try using Python 3 and learn about non-blocking network programming. They are available here.

HTML5 dataset jQuery plugin

The HTML5 specification allows any DOM element to have custom data attributes. These attributes are prefixed with data- and may be conveniently accessed through an element's dataset property. The jquery.dataset plugin provides similar functionality. is online

My friend Lang and I have started maintaining together. We'll be using it to host projects and bits of code we create in a permanent location.