Skip to content

Instantly share code, notes, and snippets.

View brapse's full-sized avatar

Sean Braithwaite brapse

View GitHub Profile
var offsets = {
'year': 0,
'month': 1,
'day': 2,
'hour': 3,
'minutes': 4
};
var dateTrunc = function (pred, date) {
var trunc = offsets[pred];
var Stream = require('net').Stream;
var netBinding = process.binding('net');
var pair = netBinding.socketpair();
var a = new(Stream)({fd: pair[0], type: 'unix'});
var b = new(Stream)({fd: pair[1], type: 'unix'});
b.resume();
var util = require('util');
var seq = new(EventEmitter);
var threads = 3;
var dead = 0;
// IPC
var pipe = netBinding.socketpair();
$~: npm bundle install
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info calculating sha1 /home/brapse/workspace/iframe-server/node_modules/.npm/.cache/iframe-server/0.2.7/package.tgz
npm info shasum a7ea55ad938936454f3fc408c68c4380b98b8e1f
npm ERR! Error installing amazon-client@/home/brapse/workspace/dist/amazon-client-v0.2.0.tar.gz
npm ERR! Error: 404 Not Found: amazon-client
npm ERR! at IncomingMessage.<anonymous> (/home/brapse/local/lib/node/.npm/npm/0.2.14-5/package/lib/utils/registry/request.js:139:16)
npm ERR! at IncomingMessage.emit (events.js:48:20)
From 397f328dae32f89c3ab61ac258f40f9a06178ae4 Mon Sep 17 00:00:00 2001
From: Sean Braithwaite <[email protected]>
Date: Thu, 2 Dec 2010 16:53:16 -0500
Subject: [PATCH] Check buffer length using string length
+ Utf8Length is really slow but has the same semantics in this case
---
src/node_buffer.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
// A repl library that you can include in your own code to get a runtime
// interface to your program.
//
// var repl = require("/repl.js");
// repl.start("prompt> "); // start repl on stdin
// net.createServer(function (socket) { // listen for unix socket connections and start repl on them
// repl.start("node via Unix socket> ", socket);
// }).listen("/tmp/node-repl-sock");
// net.createServer(function (socket) { // listen for TCP socket connections and start repl on them
// repl.start("node via TCP socket> ", socket);
@brapse
brapse / gist:668128
Created November 8, 2010 19:25
Sequence
var Sequence = function (delay) {
EventEmitter.apply(this);
this.minDelay = 1000;
this.maxDelay = 3000;
this.delay = delay;
this.delayInterval = 10; // 10th of a second
}
== January 15th 2009 ==
Morgan: yo B
me: hey, thanks for the quick response
Morgan: just to be sure, are you misspelling grammars?
I pride myself in expedient customer service
me: /me loled a little
Morgan: grammars XOR grammers
me: grammars.
wait.
wait.
# History Config
HISTFILE=~/.histfile
HISTSIZE=1000000
SAVEHIST=1000000
# Options
setopt autocd extendedglob
setopt histignoredups
setopt histignorespace
setopt histreduceblanks
Crawl.prototype.start_local = function(directory) {
var that = this;
sys.debug('starting local: ' + directory);
fs.readdir(directory, function(err, files) {
if(err) throw err;
files.forEach(function(file) {
sys.debug('file: ' + file);
var filename = directory + '/' + file;
fs.open(filename, 'r', function(err, fd) {
if(err) throw err;