This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socket.on('ping', function(fn) { | |
_.isFunction(fn) && fn(Date.now()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hasOwn = Object.prototype.hasOwnProperty; | |
var indexOf = Array.prototype.indexOf; | |
function isObjectEmpty(obj) { | |
for (var key in obj) { | |
return false; | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm info it worked if it ends with ok | |
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', '-ddd', 'install', 'julius' ] | |
npm info using npm@1.2.14 | |
npm info using node@v0.10.0 | |
npm verb node symlink /usr/bin/node | |
npm verb read json /home/skeggse/repos/package.json | |
npm WARN package.json home-pi@0.0.1 No README.md file found! | |
npm verb read json /home/skeggse/repos/node_modules/colors/package.json | |
npm verb read json /home/skeggse/repos/node_modules/express/package.json | |
npm verb read json /home/skeggse/repos/node_modules/imap/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!!5 | |
html(lang="en") | |
head | |
title= title | |
link(rel='stylesheet', type='text/css', href='/stylesheets/style.css') | |
body | |
#account_manager | |
#sign_in Sign in | |
#sign_up Sign up | |
#top |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dgram = require('dgram'); | |
var _ = require('underscore'); | |
var thumbs = { | |
twiddle: function() {} | |
}; | |
_.mixin({ | |
options: function(self, options, defaults) { | |
if (options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorial(n) { | |
if (n == 0) | |
return 1; | |
return n * factorial(n - 1); | |
} | |
function factorialb(n) { | |
var b = 1; | |
while (n) | |
b *= n--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var EventEmitter = require('events').EventEmitter; | |
// just define this in the file scope, you don't need to assign it as a property | |
var numApples = 50; | |
// pickers, because this can handle multiple pickers | |
var fruitPickers = new EventEmitter(); | |
// replentish apples every thirty seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numApples = 5; | |
function handleConn(name) { | |
var pickedApples = 0; | |
return function pick() { | |
pickedApples++; | |
numApples--; | |
console.log(name, 'has', pickedApples, 'apples'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "echo Again." >> ~/test.sh | |
echo Hello. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dgram = require('dgram'); | |
var socket = dgram.createSocket('udp4'); | |
// looks like the send might not need to be in the bind callback | |
socket.bind(8001, '0.0.0.0', function() { | |
socket.send(new Buffer('HELO'), 0, 4, 8001, 'localhost'); | |
}); | |
socket.on('message', function ondata(data, rinfo) { |