a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
| //Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace. | |
| //Inspired from David Flanagans excellent cross-platform utils http://www.davidflanagan.com/javascript5/display.php?n=20-1&f=20/01.js | |
| //Includes underscore.js _.each and _.extend methods | |
| //modified to behave like jQuery's $.ajax(), not complete. | |
| (function($) { | |
| var win=window, xhrs = [ | |
| function () { return new XMLHttpRequest(); }, | |
| function () { return new ActiveXObject("Microsoft.XMLHTTP"); }, | |
| function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); }, | |
| function () { return new ActiveXObject("MSXML2.XMLHTTP"); } | 
| complete -W "\`grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_-]*$//'\`" make | 
| MAKEFILE=$(lastword $(MAKEFILE_LIST)) | |
| REMOTE?=$(REMOTE_USER)@$(REMOTE_HOST) | |
| REMOTE_SSH?=ssh -p $(REMOTE_PORT) | |
| REMOTE_SHELL?=$(REMOTE_SSH) $(REMOTE) $(REMOTE_LOGIN) | |
| REMOTE_MAKE?=cat $(MAKEFILE) | $(REMOTE_SHELL) make -f /dev/stdin -C $(REMOTE_BASE) | |
| # LOCAL COMMANDS: | |
| hello: | 
| function mapParallel(array, callback) { | |
| return array.reduce(function(acc_p, element, index, array) { | |
| return Q.when(callback(element, index, array), function(res) { | |
| return Q.when(acc_p, function(acc) { | |
| return acc.concat([res]); | |
| }); | |
| }); | |
| }, []); | |
| } | 
| module.exports = (function(){ | |
| const MS = | |
| { seconds: 1000 | |
| , minutes: 60 * 1000 | |
| , hours: 60 * 60 * 1000 | |
| , days: 24 * 60 * 60 * 1000 | |
| , weeks: 7 * 24 * 60 * 60 * 1000 | |
| , months: 30 * 7 * 24 * 60 * 60 * 1000 | |
| , years: 365 * 24 * 60 * 60 * 1000 } | 
| # These are my notes from the PragProg book on CoffeeScript of things that either | |
| # aren't in the main CS language reference or I didn't pick them up there. I wrote | |
| # them down before I forgot, and put it here for others but mainly as a reference for | |
| # myself. | |
| # assign arguments in constructor to properties of the same name: | |
| class Thingie | |
| constructor: (@name, @url) -> | |
| # is the same as: | 
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | 
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
| // new node.js tls api | |
| var tls = require('tls'); | |
| var fs = require('fs'); | |
| var options = { | |
| key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), | |
| cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') | |
| }; | |
| var server = tls.createServer(options, function (s) { |