This file contains hidden or 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 scan = (function(window, document) { | |
/** | |
* Scans through all the pages and maps all the reviews. | |
* | |
* TODO: automatically switch to date-ordered reviews, and page backwards to | |
* beginning. | |
* | |
* @param {function(?Error, Object, Array)} callback The callback when all reviews have | |
* been found. | |
*/ |
This file contains hidden or 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
/** | |
* @param {Object.<string, boolean>} data | |
* @return {number} | |
*/ | |
function hello(data) { | |
var q = 0; | |
if (data.a) { | |
if (data.b && data.c) { | |
q = 1 | |
} else if (data.d) { |
This file contains hidden or 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) { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 util = require('util'); | |
var Writable = require('stream').Writable; | |
/** | |
* Pretends to consume the data written to it. In reality, it just eats data | |
* really slowly. | |
* | |
* @constructor | |
* @extends Writable |
This file contains hidden or 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 hidden or 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 hidden or 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 |