The JavaScript blog.


libraries animation css node modules http

AniCollection, SuperFetch

Posted on .


I usually write CSS animations by failing to remember the syntax and then copy and pasting examples until it works the way I want. In times like that a handy directory of CSS animations is essential. AniCollection (GitHub: anicollection/anicollection, License: MIT) by Dariel Noel is big collection of CSS animations. Each animation has a preview and the associated CSS in an easy copy and pastable format.


The site itself is on GitHub, and the author has built it with Grunt, css-annotation, and js-beautify.


I actually like the request module's API, but juggling multiple requests can be awkward. SuperFetch (GitHub: luin/superfetch, License: MIT, npm: superfetch) by Zihua Li is a promise-based HTTP API that is built on request:

var fetch = require('superfetch');  
fetch.get('http://example.com').then(function(body) {  
  // when the status code begins with "2", the response body will be returned.
}).catch(function(response) {
  // otherwise, the whole response(including headers) is returned.

You can use fetch.get.option to set options, and you can chain calls to option if you like. The request and response objects can be transformed with callbacks, and the author has included unit tests written with Mocha.


libraries ui ajax dom http rest

Databound, Typist

Posted on .



If you use Ruby on Rails, then you might like this Rails REST library wrapped: Databound (GitHub: Nedomas/databound, License: MIT, npm: databound, Bower: databound) by Domas Bitvinskas. The API looks a bit like the Rails syntax for database models:

User = new Databound('/users')

User.where({ name: 'John' }).then(function(users) {  
  alert('Users called John');

User.find(15).then(function(user) {  
  print('User no. 15: ' + user.name);

User.create({ name: 'Peter' }).then(function(user) {  
  print('I am ' + user.name + ' from database');

Install it with npm, Bower, or as part of a Rails asset pipeline. The author also notes that you can use it with Angular as an alternative to ngResource.


Typist (GitHub: positionly/Typist, License: MIT, Bower: Typist) by Oskar Krawczyk is a small library for animating text as if it's being typed. It can work with responsive layouts, and the author claims it has improved click-through-rates on a commercial homepage.

It doesn't have any dependencies, and is invoked by a constructor that accepts options for the animation intervals. The required markup should specify the text to be typed in the data-typist and data-typist-suffix attributes.


libraries ui ajax utilities dom http rest

Curl Converter, aja.js, sneakpeek

Posted on .

Curl Converter

Chrome's "Copy as cURL" menu item is useful, but what if you want to duplicate the same request with Node? Curl Converter (GitHub: NickCarneiro/curlconverter, License: MIT, npm: curlconverter) by Nick Carneiro can convert between cURL syntax and Node's popular request module. It also supports Python, and can be installed with npm.


aja.js (Bower: aja, npm: aja, License: MIT) by Bertrand Chevrier is an Ajax library that supports JSON and JSONP. It can be used to load large chunks of HTML or JSON, and can be installed with npm or Bower.

The API is fluent, so it can be used as a REST client like this:

  .data({ firstname: 'John Romuald' })
  .on('200', function(response) {})

It also supports some DOM manipulation:


It comes with tests that can be run with Grunt, and the readme has more examples for things like posting data.


If you're looking for a library to hide the header when the page is scrolled, then sneakpeek (GitHub: antris/sneakpeek, License: MIT, npm: sneakpeek) is nice because it's small, installable with npm, and has no external dependencies.

It's a bit like headroom.js, but easier to use with Browserify.


mac node modules http native proxy

Node Roundup: Tint, Redbird

Posted on .



Desktop apps built with node-webkit or similar technologies are on the rise. The idea is seemingly simple: package the Node runtime along with a small program that runs your Node web app as if it's a native application.

Tint is an alternative. It uses a modified version of Node that bridges to native components, so you can actually write JavaScript that creates native Mac windows, buttons, web views, dialogs, and more.

It's created by a company called True Interactions, and is MIT licensed. If you're an Objective-C developer you might like to check out Main_mac.mm, because this is where the authors have successfully integrated Objective-C++ with Node's event loop.

I built it from source and created a quick test application this afternoon to see what the API feels like:


var Window = require('Window');  
var Button = require('Button');

var mainWindow = new Window();  
var button = new Button();

mainWindow.title = 'DailyJS';

button.title = 'Hello';  
button.addEventListener('mousedown', function() {  
  button.title = '^_^';

button.addEventListener('mouseup', function() {  
  button.title = 'Hello';


  priority: 'required',
  relationship: '=',
  firstItem: button,
  firstAttribute: 'top',
  secondItem: mainWindow,
  secondAttribute: 'bottom',
  multiplier: 0.0,
  constant: 0.0

setInterval(function() {  
  button.title = Math.random();
}, 1000);

I ran the script with ./build/Release/tint example.js and got a window with a button. I wrote this script by looking at the tests to see how the API works.

I think this is a cool project and I'd really like to make a real Mac application with it, but I'm not sure how to actually distribute an application bundle that people can easily install. I'll keep playing with it and write a longer tutorial if I discover anything.


Redbird (GitHub: OptimalBits / redbird, License: BSD, npm: redbird) by OptimalBits is a reverse proxy for dealing with dynamic virtual hosts, load balancing, proxying web sockets and SSL encryption.

var proxy = require('redbird')({port: 80});

// Route to any global ip
proxy.register('optimalbits.com', '');

// Route to any local ip, for example from docker containers.
proxy.register('example.com', '');  

The documentation includes a full SSL example, and the authors are planning support for load balancing and IP filtering.


libraries node modules http network security

Node Roundup: Building Node.js Together, node-libnmap, httpolyglot

Posted on .

Building Node.js Together

TJ Fontaine wrote about Node from a release management perspective on the official Node blog, in Building Node.js Together. It covers documentation, code quality, and the growing team of core contributors and contributors that are employed full-time to work on Node:

For instance, Chris Dickinson was recently hired to work full time on Node.js, and has expressed interest in working on the current and future state of streams. But it's not who employs Chris that makes him an ideal candidate, but it will be the quality of his contributions, and his understanding of the ethos of Node.js. That's how we find members of the team.


The evilscan module uses JavaScript to enumerate over TCP ports. node-libnmap (GitHub: jas- / node-libnmap, License: MIT, npm: node-libnmap) by Jason Gerfen is an alternative that uses the nmap binary.

It will return results as JavaScript objects, so you should be able to process the output fairly easily. A basic scan looks like this:

var libnmap = require('libnmap');

var opts = {  
  range: ['localhost', '', '']

libnmap.nmap('scan', opts, function(err, report){  
  if (err) throw err


httpolyglot (GitHub: mscdex / httpolyglot, License: MIT, npm: httpolyglot) by Brian White allows you to start a server that accepts both HTTP and HTTPS connections on the same port.

It works by sniffing the first byte of the stream to see if TLS is required:

var firstByte = data[0];  
if (firstByte < 32 || firstByte >= 127) {  
  // tls/ssl
} else