The JavaScript blog.


server ringo css node

Node Roundup: Node 0.4, Stylus, Ringo 0.7

Posted on .

Welcome to the Node Roundup. Send in your apps and libraries using our
contact form or @dailyjs.

Move Code to 0.3: Node 0.4 Coming Soon

In Move Code to

on the nodejs group, Ryan Dahl recently suggested that people move code
to Node 0.3 as the next stable branch, 0.4, will be released in the next
week. Exciting times!


Stylus is yet another interesting product from LearnBoost and TJ Holowaychuk that aims to
revolutionise CSS generation. It's currently available through npm, and
can be installed with npm install stylus.

The language dramatically cuts down the amount of syntax required by
CSS, and is really what I thought LESS would be
when I first heard about it.

Almost everything is optional, including property colons, and it
supports conditionals, mixins, variables, interpolation, imports,
iteration, nested selectors, and more. TJ has already made a screencast
demonstrating the language: Stylus screencast.
It's definitely easy to see the evolution from Jade to Stylus, and I
think they'll be a joy to use together.

I also noticed TJ wrote
inspect recently, which can iterate over objects and display a hierarchy of associated properties.

Ringo 0.7

I know this is the Node roundup, but sometimes I wonder if it would be
better to name it the Server Side Roundup. Anyway, Ringo
has been released, with some
interesting new changes:

  • fs-base has been folded into the fs module
  • Script execution will continue until asynchronous ringo/scheduler and ringo/httpclient have finished
  • Resources outside a repository root can now be require'd using relative paths

There are a lot more changes in the 0.7 release notes on the Ringo


functional ringo technique

Functional Koans, Ringo 0.6

Posted on .

Functional Koans by David Laing is a way of learning functional JavaScript through testing.
Each koan has associated tests that fail, and your job is to correct the
code to make them pass. The koans presents a fundamental concept which
you must master to be able to fix the code.

The project is based on Ruby Koans by Jim
Weirich, which made a fairly big impact amongst Ruby developers. The
word Koan is used in reference to
Zen Buddhism:

As part of the training of teachers, monks, and students, koan can refer to a story selected from sutras and historical records. They may consist of a perplexing element or a concise but critical word or phrase extracted from the story.

Ringo 0.6

Ringo 0.6 is out, which includes improvements to http server and client libraries, no more extending
JavaScript objects (that code is now effectively namespaced), CommonJS
unit testing, and bunch of other changes.

The RingoJS tutorial has "App
Engine Deployment" listed in the table of contents, but the content
hasn't been written yet. Gabriel Munteanu took this example and extended
it to work more like a fully-functional blog, and called it
Ringopress. The project's documentation explains how to configure and deploy App
. If you're new to Ringo or
App Engine, this might be a nice project to play around with.

If you haven't yet looked into App Engine and JavaScript,
AppengineJS is a JavaScript port of the Python SDK by George Moschovits.


jquery events tips ringo

jQuery Custom Events

Posted on .

jQuery makes it easy to bind and trigger custom events. Although it's
not immediately apparent from the
, creating custom
events is simple and very useful.

Binding Custom Events

Events can be bound to DOM nodes like this:

$("#myElementId").bind("myCustomEvent", function(event) {
  alert("myCustom event happened!");

Triggering Custom Events

jQuery's trigger function is
used to instigate the event, passing the name of the event as a string
like this:


If you want to pass data to the handler you can use an event

var myCustomEvent = jQuery.Event("myCustomEvent");
myCustomEvent.usefulInformation = "some data";
myCustomEvent.otherStuff = "some other data";


Another cool feature of jQuery events is
namespacing, which supports triggering or unbinding specific groups of handlers without having to
reference them directly.

You can add a namespace when binding an event which can be referenced
when you unbind or trigger it. It's possible to use multiple namespaces
at once.

$('.myCSSClass').bind('myEvent.myNamespace.myOtherNamespace', function(){alert('namespaced event')}); 

If you specify a namespace when unbinding or triggering events, you need
to match one of the bound namespaces (or alternatively, if no namespace
is specified it matches everything).

$('.myCSSClass').bind('myEvent.myNamespace', function(){alert('namespaced event')}); 
$('.myCSSClass').trigger('myEvent.myNamespace'); // mentioned explicitly: will trigger
$('.myCSSClass').trigger('myEvent');  // not specified: will trigger 
$('.myCSSClass').unbind('myEvent.differentNamespace'); // won't unbind