George V. Reilly

Review: Backbone.js Testing

Title: Backbone.js Testing
Author: Ryan Roemer
Rating: ★ ★ ★ ★ ½
Publisher: Packt
Copyright: 2013
Pages: 168
Keywords: pro­gram­ming, testing, javascript, backbone, mocha, chai, sinon
Reading period: October 2013

Backbone.js Testing is a short, dense in­tro­duc­tion to testing JavaScript ap­pli­ca­tions with three testing libraries, Mocha, Chai, and Sinon.JS. Although the author uses a sample ap­pli­ca­tion of a personal note manager written with Backbone.js throughout the book, much of the material would apply to any JavaScript client or server framework.

Mocha is a test framework that can be executed in the browser or by Node.js, which runs your tests. Chai is a framework-agnostic TDD/BDD assertion library. Sinon.JS provides standalone test spies, stubs and mocks for JavaScript. They complement continue.

Generating UUIDs in JavaScript

Another Cozi Tech Blog post: Generating UUIDs in JavaScript

Exuberant Ctags and JavaScript

Exuberant Ctags is an essential complement to Vim: it generates an index of symbol names (tags) for a set of source files. In Vim, just place the cursor on a function name and type C-] to go to its definition.

Ctags works well for most of the languages that I deal with, but falls down badly on modern JavaScript. Its built-in parser simply doesn't handle de­c­la­ra­tions like these:

Sizzle.selectors.filters.animated = function(elem) { // ...
ajaxSetup: function( settings ) {

I came across Unbad's workaround earlier tonight. His code didn't work for me, so I hacked on it until it did:

--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/
--regex-js=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/
--regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/
--regex-js=/([^= ]+)[ 
continue.

Review: JavaScript: The Good Parts

Title: JavaScript: The Good Parts
Author: Douglas Crockford
Rating: ★ ★ ★ ★
Publisher: O'Reilly
Copyright: 2008
Pages: 153
Keywords: pro­gram­ming, javascript
Reading period: 27 May–15 June, 2008

Crockford is one of the world's leading JavaScript experts. In this slim volume, he explores the features of the core language, both the good parts and the warts.

JavaScript has been redeemed since 2005 with the explosive pro­lif­er­a­tion of Ajax websites. Long regarded as a toy language, suitable for little more than generating popups, we have come to learn that in the hands of experts like John Resig (of jQuery fame), JavaScript can be a powerful, expressive language. Anonymous functions, duck typing, and dynamic objects are all good continue.

Preload Ajax Data as JSON

Preloading Ajax data as JSON has helped improve the load time and perceived per­for­mance of our family software ap­pli­ca­tion. Most of the pages in our web client are dy­nam­i­cal­ly generated in the browser from a complex set of JavaScript and CSS, so we're always looking out for ways to make them appear more quickly.

More at the Cozi Tech Blog.

Debugging JavaScript in IE from Visual Web Developer 2008 Express Edition

It's not at all obvious how to use Visual Web Developer 2008 Express Edition to debug JavaScript in Internet Explorer. So I wrote it up at the Cozi Tech Blog.

Daylight Savings Time and JavaScript

The JavaScript engines in Firefox 2 (Windows) and IE6 can't handle the new Daylight Savings Time rules in the U.S. The Date() function returns a value that is off by an hour if the system time is between the second Sunday of March and the first Sunday of April.

More at the Cozi Tech Blog.

Update 2008/03/14: Mea culpa. This is not a widespread problem. It is caused by the presence of set TZ=PST8PDT in my C:\AutoExec.bat. Per KB932590, the existence of the TZ en­vi­ron­ment variable will cause the CRT to use the old DST rules. (I can't remember why I set TZ several years ago. It's part of the ac­cu­mu­lat­ed mess of continue.

Review: Pro JavaScript Design Patterns

Title: Pro JavaScript Design Patterns
Author: Ross Harmes, Dustin Diaz
Rating: ★ ★ ★ ★
Publisher: Apress
Copyright: 2008
Pages: 269
Keywords: pro­gram­ming, javascript
Reading period: 4 January–? ???, 2008

Review: Ajax Design Patterns

Title: Ajax Design Patterns
Author: Michael Mahemoff
Rating: ★ ★ ★
Publisher: O'Reilly
Copyright: 2006
Pages: 352
Keywords: web, ajax
Reading period: 29 October-?? November 2007

Greasemonkey for demos and mockups

I've been meaning to play around with Grease­mon­key for a couple of years. Grease­mon­key is a Firefox extension that allows users to install scripts that make on-the-fly changes to the look and feel of third-party websites. For example, adding price com­par­isons to Amazon or thumbnail images to Google search results. User­Scripts.org has a large repository of Grease­mon­key scripts.

I finally built my first script the other day. We're putting together a new feature at Cozi that integrates partner websites with our site. Since the feature is not yet announced, I'll just say that partners will add a link to Cozi on many of their database-driven pages. That link has a complex, continue.

Previous »