2011-11

Execute code each time the Node.js REPL starts

[2011-11-17] dev, nodejs, repl, javascript
If you start the Node.js binary without any arguments, you are in the REPL (Read-Eval-Print-Loop), a JavaScript command line. This post shows you how to execute code each time the REPL starts. That allows you to, say, automatically load modules you want to use.

Web audio APIs and the low-level approach

[2011-11-16] audio, html5, webdev
HTML5 Audio APIs - How Low can we Go?” (by Mark Boas for The Worm Hole) explains that there are currently two competing web APIs for audio. One is supported by Firefox, the other by Chrome and Safari. The former takes a low-level approach, the latter is higher-level.

What JavaScript would be like with significant newlines

[2011-11-14] dev, javascript, jslang
Update 2012-03-17: More explanations in Sect. 1.

Brendan Eich recently repeated that he regrets not having given JavaScript significant newlines. This post explains what that would be like. Quote:

Economic inequality is bad, even for the rich

[2011-11-11] society, life, business
The TED talk “How economic inequality harms societies” by Richard Wilkinson explains an interesting fact: Beyond certain basic wealth, the well-being of a society depends much more on income differences being small than on incomes being high on average.

Web technology stacks – from LAMP to Janos

[2011-11-11] dev, nodejs, javascript, webdev
The classic stack of small- to medium-scale web technologies is LAMP (Linux, Apache, MySQL, PHP). With the rise of JavaScript and NoSQL databases, another stack is poised to replace it: Janos (client-side JavaScript, Node.js, NoSQL database).

Load Node.js modules in browsers via lobrow

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

Node.js has the advantage of letting you use JavaScript on client and server. Thus, it is a major nuisance that you can’t put portable code into a file that can be loaded on both platforms. This post presents a solution.

Improving the JavaScript typeof operator

[2011-11-08] dev, javascript, jslang
The typeof operator in JavaScript is partially broken. This blog post explains how to fix it and how to extend its use to objects.

Customize LaTeX output from a shell (Unix)

[2011-11-07] latex, hack, computers
This post explains how to influence LaTeX output via a Unix shell, including the insertion of a word that you pass to a script. It is partially based on an answer given by Will Robertson on StackOverflow.

Myth: JavaScript needs classes

[2011-11-04] esnext, dev, javascript
Updates:
  • [2012-03-17] I completely rewrote this post and changed its name (which previously was “JavaScript does not need classes”).
  • [2012-07-29] Classes have been accepted for ECMAScript.next.
  • [2012-10-03] Since this article has been written, it was decided that ECMAScript will have the special property __proto__ instead of the <| operator.
  • [2013-10-21] Instead of the extension operator, ECMAScript.next will have the function Object.assign().
A popular JavaScript myth is that JavaScript’s prototypal inheritance is complicated and that to fix it, we need classes. This post explains that that opinion is not completely wrong, but misses some important points.

Uncurrying “this” in JavaScript

[2011-11-02] dev, javascript, advancedjs, jslang
Update 2011-12-17: New section “Making uncurryThis() safe to use in the presence of untrusted code”.

This post explains applications of uncurrying and currying this in JavaScript. It has been triggered by a tweet of Brendan Eich’s.