Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| 'use strict'; | |
| // The purpose of this example is to show | |
| // how you can block the event loop with JavaScript. | |
| // There is 3 routes | |
| // / respond with Hello, World text | |
| // /block uses JavaScript while for 5 seconds | |
| // /non-block uses setTimeout for 5 seconds | |
| // Do the following |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| -server | |
| -Xms512m | |
| -Xmx2048m | |
| -XX:MaxPermSize=512m | |
| -XX:ReservedCodeCacheSize=256m | |
| -XX:+UseCodeCacheFlushing | |
| -XX:+UseCompressedOops | |
| -XX:+UseConcMarkSweepGC | |
| -XX:+AggressiveOpts | |
| -XX:+CMSClassUnloadingEnabled |
| var util = require('util'), | |
| EventEmitter = require('events').EventEmitter; | |
| var Server = function() { | |
| var self = this; | |
| this.on('custom_event', function() { | |
| self.logSomething('custom_event'); | |
| }); |
| var spawn = require("child_process").spawn; | |
| var Q = require("q"); | |
| /** | |
| * Wrap executing a command in a promise | |
| * @param {string} command command to execute | |
| * @param {Array<string>} args Arguments to the command. | |
| * @param {string} cwd The working directory to run the command in. | |
| * @return {Promise} A promise for the completion of the command. | |
| */ |
| // NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension | |
| { | |
| // Settings | |
| "passfail" : false, // Stop on first error. | |
| "maxerr" : 100, // Maximum error before stopping. | |
| // Predefined globals whom JSHint will ignore. | |
| "browser" : true, // Standard browser globals e.g. `window`, `document`. |
W3C Introduction to Web Components - explainer/overview of the technologies