Skip to content

Instantly share code, notes, and snippets.

View billywhizz's full-sized avatar
🤓
always be learning

Andrew Johnston billywhizz

🤓
always be learning
View GitHub Profile
@billywhizz
billywhizz / 0_reuse_code.js
Created April 5, 2017 11:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@billywhizz
billywhizz / foo.md
Created April 5, 2017 11:48
the end of the world as we know it

this is a test. i am writing. how cool

here is a list

  • omg

here is some code

let a = b;
@billywhizz
billywhizz / README.md
Created February 22, 2017 23:45
uWebSockets Techempower Benchmark

install

npm install

run node.js server

node app
function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
@billywhizz
billywhizz / Array.sliceAfter.js
Created June 6, 2013 22:48
get slice of sorted array greater than passed in value
Array.prototype.sliceAfter = function(expr) {
var index = 0;
var found = this.some(function(v, i, a) {
if(v > expr) {
index = i;
return true;
}
});
if(!found) return [];
return this.slice(index);
@billywhizz
billywhizz / statement-cache.diff
Created October 25, 2012 17:49
node-oracle statement cache patch
diff --git a/src/oracle_bindings.cpp b/src/oracle_bindings.cpp
old mode 100644
new mode 100755
index bbcf611..1ea38a2
--- a/src/oracle_bindings.cpp
+++ b/src/oracle_bindings.cpp
@@ -84,6 +84,7 @@ void OracleClient::EIO_Connect(uv_work_t* req) {
std::ostringstream connectionStr;
connectionStr << "//" << baton->hostname << ":" << baton->port << "/" << baton->database;
baton->connection = baton->environment->createConnection(baton->user, baton->password, connectionStr.str());
@billywhizz
billywhizz / bencCallbacks.js
Created April 12, 2012 12:40
response to bruno's streamline benchmark
"use strict";
var fs = require('fs');
var cache = {}, hit = 0, missed = 0;
var count = parseInt(process.argv[2]) || 1000000;
var fname = __dirname + "/benchCallbacks.js";
function bench(cb) {
var total = 0;
var current = 0;
function handleResult(err, data) {
@billywhizz
billywhizz / results.txt
Created April 10, 2012 17:02
streamline.js overhead
test.js:
29,222,676 calls per second
test-named:
50,505,050 calls per second
test-streamline.js:
332,557 calls per second
@billywhizz
billywhizz / http.js
Created March 29, 2012 03:49
node.js url escaping example
var http = require("http");
http.createServer(function (req, res) {
console.log(require("url").parse(req.url, true));
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(80, '0.0.0.0');
@billywhizz
billywhizz / haiku.js
Created March 1, 2012 11:16
haiku test
res.writeHead(200);
throw(new Error("poof!"));
res.end();