2012-09

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.

Distributed social networks, an alternative to Facebook and Twitter

[2012-08-16] computers, social, federated social networks
Are you looking for an alternative to Facebook and Twitter? Do you think they should work more like email, with multiple servers, multiple apps, and the ability to move and back up your content? Then distributed social networks may interest you.

DOM: element IDs are global variables

[2012-08-15] dom, dev, javascript, clientjs
Several tweets mentioned that in order to display an element in Chrome’s JavaScript console, you only have to type its ID. @johnjbarton pointed out that that is because all element IDs are global variables. This blog post explains a few more details.

A closer look at _.extend and copying properties

[2012-08-13] underscorejs, dev, javascript, jslang
Underscore.js is a useful complement to JavaScript’s sparse standard library. This blog post takes a closer look at its extend function. Along the way, it will give a detailed explanation of how to best copy properties in JavaScript. This post requires basic knowledge of JavaScript inheritance and prototype chains (which you can brush up on at [1]), but should be mostly self-explanatory.