TypedFunc, HTML5 Rubik's Cube, Backbone-Require-Boilerplate

2012-06-01 00:00:00 +0100 by Alex R. Young


TypedFunc (License: MIT, npm: TypedFunc) by Christopher de Beer is an interesting library for creating typed functions in JavaScript. By using a chainable API, functions can be created that will validate their inputs automatically:

var TypedFunc = require('TypedFunc');

var setName = (new TypedFunc()).throws('string', {}, function(name) {
  console.log('Setting name:', name);
  return name;


The last call, setName(1), will raise an exception like this:

Error: Invalid Function type. Should return string but returned number.

TypedFunc can also support Node's function(err, value) style of callbacks, rather than throwing an exception.

HTML5 Rubik's Cube

Rubik's Cube screenshot

This HTML5 Rubik's Cube by Diego Ferreiro Val uses YUI and CSS transformations to create a 3D Rubik's Cube. It can also solve itself, and the arrow buttons will undo or redo the last move.

The author has written a detailed tutorial about how he developed it here: Tutorial: Rubik's cube with HTML5 (CSS3 + JavaScript).


I know there's a lot of boilerplates out there, but Greg Franko has put a lot of effort into Backbone-Require-Boilerplate (License: MIT).

It's designed to encourage sharing code between desktop and mobile sites, and includes a recent version of RequireJS that supports loading non-AMD libraries.