Skip to content

Instantly share code, notes, and snippets.

var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/focus-bug.log',
smartCSR: true
});
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
/home/cjj/work/node_modules/square/lib/square.js:1517
return fn(err);
^
TypeError: undefined is not a function
at done (/home/cjj/work/node_modules/square/lib/square.js:1517:14)
at reduced (/home/cjj/work/node_modules/square/lib/square.js:1430:21)
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:251:13
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:133:21
at /home/cjj/work/node_modules/square/node_modules/async/lib/async.js:248:17
at preprocessing (/home/cjj/work/node_modules/square/lib/square.js:708:27)
var fs = require('fs');
var assert = require('assert');
var bcoin = require('bcoin');
var bn = require('bn.js');
var parser = new bcoin.protocol.parser;
var wallet = new bcoin.wallet({
pub: bcoin.utils.fromBase58('hY29VUa4xfrs4vDUd4aF3cjkMoH5xegU6VzGNBqjTtCm')
});

Keybase proof

I hereby claim:

  • I am chjj on github.
  • I am chjj (https://keybase.io/chjj) on keybase.
  • I have a public key whose fingerprint is B4B1 F62D BAC0 84E3 33F3 A04A 8962 AB9D E666 6BBD

To claim this, I am signing this object:

[obj] [structure] [property] [value]
test_article none title A Test Article
test_article none content Hello world!
test_article tags 0 misc
test_article tags 1 etc
test_article comments.0 poster_name AvgJoe
test_article comments.0 content This article is amazing
test_article comments.1 poster_name SuperNerd
test_article comments.1 content No it's not!
another_article none title Another Article
@chjj
chjj / loop-bench.js
Created May 1, 2011 10:00
loop benchmarks
var a = [];
for (var i = 0; i < 100000; i++) a.push('a');
var o = {};
for (var i = 0; i < 100000; i++) o['key_' + i] = 'a';
(function() {
var s = Date.now();
var i = a.length;
while (i--) {
@chjj
chjj / joinvconcat.js
Created May 7, 2011 05:29
join v concat
(function() {
var start = Date.now();
var i = 1000000;
while (i--) {
var str = '';
str += 'a';
str += 'a';
str += 'a';
str += 'a';
str += 'a';
@chjj
chjj / calleebench.js
Created May 9, 2011 08:22
callee bench
var times = 15000;
(function() {
var i = 0, start = Date.now();
(function() {
if (++i < times) arguments.callee.call();
})();
console.log('callee', Date.now() - start);
})();
@chjj
chjj / simple_request.js
Created May 19, 2011 22:46
simple request
var http = require('http')
, parse = require('url').parse
, StringDecoder = require('string_decoder').StringDecoder;
var LIMIT = 10 * 1024;
var request = function(url, body, func) {
if (typeof url !== 'object') {
url = parse(url);
}
@chjj
chjj / base64fix.js
Created June 15, 2011 12:07
base64 cipher fix
// a shim to fix base64 cipher output, untested
var Cipher = require('crypto').Cipher;
var update = Cipher.prototype.update,
final = Cipher.prototype.final;
Cipher.prototype.update = function(data, input, output) {
if (output === 'base64') {
data = update.call(this, data, input, 'binary');
return new Buffer(data, 'binary').toString('base64');