2011-12

Fake operator overloading in JavaScript

[2011-12-17] dev, javascript, jslang
Update 2012-01-29: The post “What is {} + {} in JavaScript?” looks at the addition operator in more detail.

This post describes how to do a limited version of operator overloading in JavaScript. With the technique described here, you’ll be able to implement a type StringBuilder that can be used as follows:

    var sb = new StringBuilder();
    sb << add("abc") << add("def");
And a type Point that can be used as follows:
    var p = new Point();
    p._ = new Point(1, 2) + new Point(3, 4) + new Point(5, 6);
    p._ = new Point(1, 2) * new Point(3, 4) * new Point(5, 6);

Write your shell scripts in JavaScript, via Node.js

[2011-12-16] jsshell, dev, nodejs, javascript, shell
Update 2012-08-21: All posts about shell scripting via Node.js have the label “jsshell”.

Do you know JavaScript and want to write a shell script? Then you should give Node.js a try. It is easy to install and shell scripts are a great way to get to know it. This post explains the basics.

What’s new in CSS 4 selectors

[2011-12-13] css, dev, html, webdev
The following are the highlights of what is new in CSS 4 selectors:

Movie titles and lines in JavaScript

[2011-12-08] dev, javascript, humor
Tweets marked with the hashtag #MovieLinesInCode express a movie line or title in programming language code. This post gives some examples in JavaScript; most of them are paraphrased from the blog post “Best of #MovieLinesInCode” by Arialdo Martini [link via Michael Haszprunar].

Handling footnotes and references in HTML

[2011-12-03] dev, html, webdev
This post examines what options one has for handling footnotes and references in HTML. It then presents a library that helps you with handling them.

When is it OK to use == in JavaScript?

[2011-12-02] dev, javascript, jslang
Update 2011-12-07: Added case 5 and a conclusion.

Short answer: never. This post looks at five possible exemptions from the rule to always use === and explains why they aren’t.

2011-11

A closer look at super-references in JavaScript and ECMAScript 6

[2011-11-29] esnext, dev, javascript, jslang
Update 2013-04-09: now simulates the approach of the ECMAScript 6 specification draft (search for "HomeObject" to find the relevant parts).

This post examines how super-references work in JavaScript and how they will be simplified by ECMAScript 6. To understand this post, it helps to be familiar with JavaScript inheritance. If you are not, consult [2].

Mnemonics for remembering the CSS order of top right bottom left

[2011-11-27] css, dev, html, webdev
Whenever one specifies values for all directions in a single CSS property, one has to adhere to the standard order: top comes first, right second, bottom third, and left fourth. This post mentions three mnemonics for remembering that order.

Node.js v0.6.3: NPM included

[2011-11-25] dev, nodejs, javascript
Node.js version 0.6.3 (stable) came out on 2011-11-25. Highlight (quoting “Node v0.6.3” by piscisaureus for node blog):

V8’s incremental garbage collector: shorter pauses, better interactive performance

[2011-11-25] v8, jsengine, dev, javascript, chrome
Quoting “A game changer for interactive performance” by Vyacheslav Egorov and Erik Corry for The Chromium Blog: