2011-10

Enums for JavaScript

[2011-10-24] dev, javascript, advancedjs, jslang
This post describes a JavaScript implementation of enums, enumerations of symbols. The idea originally comes from Allen Wirfs-Brock, via a thread on the es-discuss mailing list.

Printing objects on Node.js

[2011-10-23] dev, nodejs, javascript
Problem: If a data structure is too deeply nested, Node.js stops showing the details. This post presents two solutions.

Universal modules (browser, Node.js): imports and universal tests

[2011-10-20] dev, javascript, jsmodules, jslang
Update 2011-11-19. This post is now superseded by “Bridging the module gap between Node.js and browsers”.

This post explains how to write modules that are universal – they run on browsers and Node.js. A previous post showed a simple way of doing so, this post presents a more sophisticated solution that also handles modules importing other modules. Additionally, we use the unit test framework Jasmine to write tests for those modules that are equally universal.

Universal unit testing (browser, Node.js) with Jasmine

[2011-10-18] dev, javascript, jsmodules, jslang, jstools
Update 2011-11-19: Bridging the module gap between Node.js and browsers. [With the given information, you can write your unit tests as modules that run on both platforms.]

This post gives a quick introduction to the JavaScript unit test framework Jasmine. It has the advantage of allowing tests to be run both in browsers and on Node.js.

A JavaScript class pattern that starts with a function

[2011-10-17] dev, javascript, jslang
There are too many JavaScript class patterns and inheritance APIs out there. Here is another one. The twist: Its core construct is a function, not an object literal.

The power of the Asynchronous Module Definition

[2011-10-14] dev, javascript, jsmodules, jslang
Update 2011-11-19: Bridging the module gap between Node.js and browsers

This post explains Asynchronous Module Definition (AMD), a standard for defining modules in JavaScript and contrasts it with the currently very popular CommonJS synchronous modules.

logo.js – JavaScript has a (semi-)official logo

[2011-10-13] dev, javascript
On Oct 4th, Chris Williams (@voodootikigod) published logo.js on GitHub.

Google Dart – overview and comments

[2011-10-10] dev, google, dart, webdev
Today, it has finally happened: At the GOTO conference, Google has officially presented its new programming language, Dart. This post gives an overview of Dart and provides a few comments on how it fits into the current programming language landscape.

Unix shell: search for a text via “find” and “grep”

[2011-10-06] dev, unix, shell
This post shows you how to use “find” and “grep” to search for a text string in all files that are directly or indirectly contained in a given directory.

Displaying a square root with HTML

[2011-10-04] dev, html5, webdev, math
This post shows two ways of displaying a square root with HTML.