Skip to content

Instantly share code, notes, and snippets.

Christopher Jeffrey (JJ) chjj

Block or report user

Report or block chjj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9127877
var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/focus-bug.log',
smartCSR: true
});
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
View gist:9647483
/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)
View tx-pool-fix-clean.js
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')
});
View keybase.md

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:

View lite.txt
[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
loop benchmarks
View loop-bench.js
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--) {
View joinvconcat.js
(function() {
var start = Date.now();
var i = 1000000;
while (i--) {
var str = '';
str += 'a';
str += 'a';
str += 'a';
str += 'a';
str += 'a';
View calleebench.js
var times = 15000;
(function() {
var i = 0, start = Date.now();
(function() {
if (++i < times) arguments.callee.call();
})();
console.log('callee', Date.now() - start);
})();
View simple_request.js
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 Jun 15, 2011
base64 cipher fix
View base64fix.js
// 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');
You can’t perform that action at this time.