CapitolJS Conference 2011 Schedule and Overview

Table of Contents

1. Overview

2. Schedule

2.1. 9:15 AM Douglas Crockford: JavaScript and the Brain

2.1.2. Why jslint

2.1.4. Canonization reqiures clarity

Example: canonization of the bible with constantine required introduction of punctuation and spacing.

2.1.10. ++ is hardly optimal when looking at += 1

x++ vs. ++x ; pre-post increment difference forces a code reviewer to go back and check all code from the author.

2.1.11. var a = b = 0

This actually become a global issue:

b = 0; var a = b;

Example:

function multAssign() { var a = b = 0; console.log('a' + a); console.log('b' + b) } ; multAssign(); console.log('b' + b)

2.1.13. CoffeeScript

Wished that JavaScript looked more like CoffeeScript but debugging code

2.1.14. Why do language designers add bad parts

Language is an experiment…

JavaScripts combination of lambdas and prototypes worked well.

Not all worked well.

2.2. 9:45 AM Ben Combee: webOS

2.2.1. Architectural discussion

WebKit, Node.js Service Runtime, webOS Services

2.2.2. Enyo

Thisi s for full page applictions. js over html.

2.2.3. Node.js

Used as part of the service bus.

2.3. 10:30 AM Nicholas Zakas: High Performance JavaScript

2.3.1. UI Thread

Paint operations are queued since there could be a number of UI changes queued from the event.

2.3.2. No single JavaScript job should

Per Nielson: .1s is the limit to a user sense of instantaneous.

2.3.3. Don't interrupt UI updates with script calls

Download doesn't block with dynamic load for document.createElement.

2.3.4. <script defer src=''>

Avoid slow load: dynamically, deferred, asycn

Downloaded but not run until all UI is completed.

2.3.5. <script async src=''>

Runs as soon as possible. Order isn't preserved (by design).

2.3.6. Technique 1: Split execution setTimeout

todo = items.concat(); start = +new Date()

2.3.7. Technique 2: Script Yeilding

process.nextTick()

msSetImmediate: // MSIE 10 setImmediate(function(0 {

});

https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html

2.3.8. Technique 3: Web Workers

new Worker…

self.onmessage…

Based in part on http://www.html5rocks.com/en/tutorials/workers/basics/

2.3.10. Handling document.write after page load

Overwrite document.write to handle load…

2.4. 11:00 AM Mikeal Rogers: node.js module tour

2.4.1. Node core doesn't have all features you might reasonably want

This falls to external libraries

2.4.3. npm utilies

% npm explore request 0 master[2708668] 11:10:53

Exploring usr/local/lib/node.npm/request/active/package Type 'exit' or ^D when finished

2.4.4. npm libraries

http://search.npmjs.org/

underscore 216 coffee-script 175 request 141 express 141 connect 130 optimist 127 colors 90 uglify-js 85 socket.io 85 redis 76

2.4.5. optimist

https://github.com/substack/node-optimist

Mentioned as the best options parser.

----------–— 1.js var optimist = require('optimist'); console.log(optimist.argv); ----------–— 1.js

$ node 1.js asdfasdfasd asdf asdf { _: [ 'asdfasdfasd', 'asdf', 'asdf' ], '$0': 'node ./1.js' }

2.4.6. request

Advanced HTTP client.

request.pipe() is a core feature.

2.4.7. socket.io

2.5. 11:45 AM Jed Schmidt: Code Golf

http://140byt.es/

function (a) { new Option(a).innerHTML; }

@jedschmidt on 140byt.es