The JavaScript blog.


node project-management modules apps slides presentations react

NewSprint, Spectacle

Posted on .


NewSprint (GitHub: rodati/newsprint, License: MIT, npm: newsprint) from Rodati is a command-line Node tool for generating a mobile-friendly email based on Trello cards.

I use Trello for project management, and for a while I archived each week (or sprint) into a list so it was easy for management to see what we've completed recently. This process could be automated with NewSprint, by sending an email with card summaries. The emails look very nice, and I like the fact it uses a command-line tool with JSON files for configuration.



Ken Wheeler sent in Spectacle (GitHub: FormidableLabs/spectacle, License: MIT, spectacle), a React-powered presentation library.

With Spectacle you can write slides with JSX. It supports tags like <Deck>, <Slide>, and there are even layout tags for making text appear in the right place without too much fiddling about with CSS. Here's a very basic example of a slide:

export default class extends React.Component {  
  render() {
    return (

It even supports a presenter view, so you can see the next side and the current time. If you're currently addicted to React then this will probably be preferable to messing around in Keynote/PowerPoint/etc.


irc node modules security talks slides

Node Roundup: 0.10.24, irc-message-stream, 100% Uptime

Posted on .

Node 0.10.24 Released

Node 0.10.24 was released soon after 0.10.23. It updates uv and npm, but presumably this release was due to CVE-2013-6639 and CVE-2013-6640. These are security related patches for V8:

... allows remote attackers to cause a denial of service (out-of-bounds read) via JavaScript code that sets a variable to the value of an array element with a crafted index

If you run this example in Node 0.10.22 you should see a segfault.

var size = 0x20000;  
var a = new Float64Array(size);  
var training = new Float64Array(10);

function store(a, index) {  
  var offset = 0x20000000;
  for (var i = 0; i < 1; i++) {
    a[index + offset] = 0xcc;

store(training, -0x20000000);  
store(training, -0x20000000 + 1);  
store(training, -0x20000000);  
store(training, -0x20000000 + 1);

for (var i = -0x20000000; i < -0x20000000 + size; i++) {  
  store(a, i);


irc-message (GitHub: expr / irc-message, License: BSD 2-Clause, npm: irc-message) by Fionn Kelleher is a small parser that outputs objects based on RFC1459. The author has used it to create irc-message-stream, which is a transform stream.

That means you can take a socket connection to an IRC server and pipe it through your own stream handlers:

var net = require('net');  
var MessageStream = require('irc-message-stream');  
var messageStream = new MessageStream();

messageStream.on('line', function(line) {  
  console.log('Raw line:', line);

messageStream.on('data', function(message) {  
  console.log('Parsed message:', JSON.stringify(message));

var socket = net.connect(6667, 'irc.freenode.net');  

I think this is a great way to handle IRC in Node -- taking advantage of the newer streams API seems a lot more idiomatic than other approaches that I've seen (and made!).

Towards 100% Uptime with Node

William sent in his slides for a talk called Towards 100% Uptime with Node. The slides cover the difficulties of handling uncaught exceptions in a cluster of Node processes, and ensuring that every request has a response, even if it's to report an error.

One of the tips he mentions is to be able to generate errors on demand for development and staging. I do this in my tests -- if critical paths are expected to throw exceptions, emit 'error' events, or return error objects to callbacks, then all of these eventualities should be hit as part of automated testing.

The Node applications I work on for my day job are hosted on Heroku, and I've found you have to be extremely careful with code that throws errors and causes the process to stop. Sometimes Heroku gets confused about the state of a process and won't gracefully restart it, so a worker just hangs for an undefined amount of time. The way I stopped this was to fix all the bugs, which sounds like an obvious thing to say, but it took lots of log file archaeology. Coincidentally, Heroku's default logging is inadequate, so you have to send logs to a syslog daemon somewhere, or a service like Loggly (which I preferred to Splunk).


ecmascript webgl slides standards

randexp.js, ECMAScript 5 Presentation, Online Editor for Sparks.js

Posted on .


randexp.js (GitHub: fent / randexp.js, License: MIT, npm: randexp) by Roly Fentanes is a library for creating random strings based on a regular expression. The resulting string will match the expression provided:

/hello+ (world|to you)/.gen
// => hellooooooooooooooooooo world

A more useful example might be generating a random date:

new RegExp((January|February|March|April|May|June|July|August|September|October|November|December) ([1-9]|[12][0-9]|3[01]), (19|20)[0-9][0-9]).gen  
// March 4, 2038

This could be a useful way to generate test data in unit tests.

The way the RegExp object is modified by this library goes against the grain a little bit, and using a getter to return values seems a little bit odd, so I've asked the author about the API design through GitHub.

ECMAScript 5 Presentation

I don't usually post slides, because without the corresponding talk they're usually too hard to follow. ECMAScript 5 by Damian Wielgosik is a 150 slide presentation that introduces ECMAScript 5, and is relatively easy to follow if you don't mind pressing the right arrow key 150 times.

The majority of the slides are concerned with new methods on Object, and some patterns that make use of these new methods are explained. Other areas covered include Function.prototype.bind, new Array.prototype methods, and strict mode.

Particles: Online Editor for Sparks.js


Particles: Online Editor for Sparks.js is an introductory tutorial for sparkseditor (GitHub: jeromeetienne / sparkseditor, License: MIT) by Jerome Etienne which is a GUI editor for Sparks.js, a 3D JavaScript particle engine.

Press the "code" button to show the code used to generate the particle system. The code can be edited, and the changes will be displayed in real time. To share the results, press the "export" button.

A wide range of effects can be created with Sparks.js. There are examples available at jabtunes.com/labs/arabesque/.