The JavaScript blog.


templating node modules async fibers images thumbnails jade

Node Roundup: 0.6.15, node-inherit, Synchronize.js, jaded

Posted on .

You can send in your Node projects for review through our contact form or @dailyjs.

Node 0.6.15

Node 0.6.15 is out. It includes npm 1.1.16, and some platform-specific bug fixes for Windows and Mac OS.


Thumbbot (GitHub: vdemedes / thumbbot, License: MIT, npm: thumbbot) by Vadim Demedes is a thumbnail generator API built with PhantomJS, ImageMagick, and ffmpeg.

The Thumbbot class is instantiated with a source and output file:

bot = new Thumbbot 'video.mp4', 'video_thumb.png'  
bot.set width: 200, height: 150  
bot.set position: '00:05:04'  
bot.snap (err) ->  
    # done

The author has included Mocha tests, and various output formats are supported (png, jpg, gif).


node-inherit (License: MIT, npm: inherit) by Dmitry Filatov adds some sugar to help with class-like declarations, constructors, super calls, and static methods.

An inherited class looks like this:

var B = inherit(A, {  
    getProperty: function() {
      return this.property + ' of instanceB';

    getType: function() {
      return this.__base() + 'B';

  staticMethod: function() {
    return this.__base() + ' of staticB';

This example assumes a class called A -- notice how the getType method can access A's getType using this.__base. The full example can be viewed in the project's readme.

Dmitry has included some Nodeunit tests that also demonstrate the main features of the library.


Synchronize.js (GitHub: alexeypetrushin / synchronize, License: MIT, npm: synchronize) by Alexey Petrushin is another library that's built on fibers to attempt to "flatten" all of those pesky callbacks people like to talk about on Hacker News.

Existing methods can be wrapped with the sync method provided by the library:

var sync = require('synchronize')  
  , fs = require('fs');

fs.readFile_ = sync(fs.readFile);

sync.fiber(function() {  
  var data = fs.readFile_(__filename, 'utf8');

  try {
    data = fs.readFile_('invalid', 'utf8');
  } catch (err) {

Asynchronous methods can be used in a synchronous fashion within the sync.fiber callback. Wrapped functions will behave as if return and throw were called synchronously. The author has written Mocha tests, but the library itself is fairly small so it's not too hard to figure out how it uses fibers to wrap functions: synchronize.js.


jaded (License: MIT, npm: jaded) from Fractal is an alternate command-line interface for Jade that includes AMD support:

  Usage: jaded [options]


    -h, --help            output usage information
    -V, --version         output the version number
    -i --input [folder]   Specify input folder
    -o --output [folder]  Specify output folder
    -d --development      Beautify output and insert line numbers
    -a --amd              Wrap output in AMD closure


jquery plugins jqueryui images thumbnails

jQuery Roundup: modplug, NailThumb, HiddenPosition

Posted on .

Note: You can send your plugins and articles in for review through our contact form or @dailyjs.


modplug (GitHub: lrsjng / modplug, License: MIT) by Lars Jung is an abstraction on top of jQuery plugins that makes adhering to jQuery's Plugins/Authoring document a little bit easier.

Using modplug to define a plugin will automatically put methods under the same "namespace". Static methods can also be defined:

modplug('color', {  
  statics: {
    random: function() {
      return 'hsl(' + Math.floor(Math.random() * 360) + ',95%,75%)';

  methods: {
    back: function(col) {
      return this.each(function () {
        $(this).css('background-color', col);

$(selector).color('back', '#f00');

// get a hsl formatted color string
var col = $.color.random();  


NailThumb (Repository: SourceForge / NailThumb, License: GPL v3) from Garralab is an image thumbnail plugin that can apply animation effects and a scrolling tooltip. A container is assumed, so basic usage looks like this: $('.nailthumb-container').nailthumb().

CSS has been supplied, and there are also LESS mixins.


HiddenPosition (Repository: SourceForge / HiddenPosition, License: GPL v3) also from the developers at Garralab is based on jQuery UI Position, but has been adapted to work with hidden elements. There's an interactive demo on the project's page that shows how it works.

The API is compatible with $().position, so existing jQuery UI projects can simply swap this with $().hiddenPosition.