2012-10

JavaScript: __proto__

[2012-10-03] esnext, dev, javascript, __proto__, jslang
[This post is part of a series on the special property __proto__]

This blog post looks at the special property __proto__, which allows you to get and set the prototype of an object. In order to understand this post, you should be familiar with JavaScript’s prototypal inheritance [1].

2012-09

Support for the Web Audio API is growing

[2012-09-30] dev, html5, javascript, clientjs

A quine in JavaScript

[2012-09-24] dev, javascript, jslang
Quoting Wikipedia:
A quine is a computer program which takes no input and produces a copy of its own source code as its only output.
@cowboy (Ben Alman) gives the following example for JavaScript:
    !function $(){console.log('!'+$+'()')}()
Why does the quine work? The above code uses several tricks.

JavaScript: single quotes or double quotes?

[2012-09-17] dev, javascript, jslang, jsstyle
Today, I’ve asked on Twitter:
JavaScript: single quotes versus double quotes. Any preferences?
And I got great answers. Two funny examples:

Expressions versus statements in JavaScript

[2012-09-13] dev, javascript, jslang
Update 2012-09-21: New in Sect. 4: using void for IIFEs, concatenating IIFEs.

This blog post looks at a syntactic distinction that is unfortunately quite important in JavaScript: the difference between expressions and statements.

The empty regular expression

[2012-09-07] dev, javascript, jslang, regexp
This blog post takes a look at the empty regular expression.

JavaScript: the glass is half full

[2012-09-04] dev, javascript, jslang
JavaScript is widely used these days. But there are still many people who dislike it, which is why Dart and – to a lesser degree – CoffeeScript have passionate fans. Recently, Crockford, who has done much to establish JavaScript as a credible general-purpose programming language, called it “tragically important”. In this blog post, I argue that we should see JavaScript’s glass (cup?) as half full and not as half empty.

2012-08

The Zen of Python

[2012-08-30] programming, dev, python
The “Zen of Python” is a mini style guide for Python code that is also interesting if you don’t program Python. Its abstract reads:
Long time Pythoneer Tim Peters succinctly channels the BDFL's [Benevolent Dictator For Life, a nickname of Python creator Guido van Rossum] guiding principles for Python's design into 20 aphorisms, only 19 of which have been written down.

What object is not an instance of Object?

[2012-08-28] dev, javascript, jslang
Question: What object is not an instance of Object? Or, put differently: What value v makes the following three expressions true?
    typeof v === "object"
    v !== null
    !(v instanceof Object)

Reload a web browser when a file changes (Node.js, Grunt, Mac)

[2012-08-21] jsshell, dev, nodejs, javascript
2012-08-24: JSReload now also supports Chrome/Mac.

This blog post explains how to use Node.js to reload a tab in Safari whenever a file changes. Alas, this solution only works on a Mac, because it relies on AppleScript to remotely control Safari. You can download it as project JSReload on GitHub.