The state in which all resistance to progress is non-present. Easy flow of information from subconscious to conscious mind, characterized by clarity of purpose, speed of achievement and the full architecture of your project being held intact at the front of your mind. “Peak zone” is typically sustainable for 2-4 hours but takes 15-30 minutes to “boot up” into and is easily knocked down like a deck of cards if the “zonee” is disturbed by someone outside the zone.
Some of the most useful and lasting content has come from letters between colleagues. In this tradition, I
will post some developer insight that’s shared between myself and other developers.
Tim
You’ve sent out some good stuff lately [on our JavaScript DL]. What’s your source? Is there a site I can check daily—a TMZ for developers?
James
I’ve decided to share even when I’m really “in the zone”, whereas previously I shared when I was bored
I make liberal use of IFTTT. I let the computers monitor the web and ping me when something “interesting” happens. E.g. I have Facebook’s Github profile monitored for new repos
I listen to the “5 Minutes of JavaScript” podcast. 3/4 of their content is too junior, but the 1/4 that’s not is worth it
Tradition in Node.js dictates you import core modules using this style:
1 2
var fs = require('fs'); fs.readFile(packageJSONPath, readOperationDidFinish);
I’ve adhered to that style for the most part, but it’s always rubbed me the wrong way.
As a core modules that points to a collection of static methods, capitalization is more appropriate.
1 2
var FS = require('fs'); FS.readFile(packageJSONPath, readOperationDidFinish);
Where the correct decision becomes most apparent is when using the path module:
1 2 3
var Path = require('path'); varjoin = Path.join; var path = join(process.cwd(), 'package.json');
We used lowercase for local values, and using lowercase for the path module easily results in naming conflicts.
I am an idiot who subconciously likes pugs, so I often type git pug instead of git push or git pull. Is this truly a problem?
Note if I execute the following:
1
npm install pugme -g
Then place this in my ZSH aliases file:
1 2 3 4 5 6 7
git() { if [[ $@ == "pug" ]]; then command pugme else command git "$@" fi }
mkdir -p ~ZSH_CUSTOM/plugins cd ~ZSH_CUSTOM/plugins git clone git://github.com/rummik/nvm-zsh.git cd nvm-zsh git submodule update --init
Then edit the plugins array in your ~/.zshrc to include nvm-zsh so that it
looks somewhat like this: plugins=(nvm-zsh history-substring-search git osx ruby)
Installing a newer version of node
Run nvm ls-remote to determine the latest version of Node
Install it: nvm install v0.11.15
Run node --v8-options | grep harmony to determine which harmony features are supported
Start using harmony features by running your code with node --harmony foo.js
Gotchas w/ Arrow Functions in ES6/Harmony
Note that the following does not work:
1 2 3 4 5 6 7 8 9
functionES6Example(){} ES6Example.prototype.foo = function(bar){ return((baz) => { this.bar = baz })(bar) } var es6Example = new ES6Example es6Example.foo('qux') console.info(es6Example.bar) //undefined
But this does:
1 2 3 4 5 6 7 8
functionES6Example(){ this.foo = baz => { this.bar = baz } } var es6Example = new ES6Example es6Example.foo('qux') console.info(es6Example.bar) // 'qux'
I’m testing out Scout App for server monitoring. It requires something called mpstat and it apparently isn’t installed.
To get it, run apt-get install sysstat.