Skip to content

Instantly share code, notes, and snippets.

View Raynos's full-sized avatar

Jake Verbaten Raynos

View GitHub Profile
package staticConfig
import (
"io/ioutil"
"reflect"
"encoding/json"
"github.com/buger/jsonparser"
"github.com/pkg/errors"
# Use go test to generate coverage into ./coverage/cover.out
# go test ./... -cover -coverprofile ./coverage/cover.out
.PHONY: view-istanbul
view-istanbul:
@go get github.com/axw/gocov/gocov
@gocov convert ./coverage/cover.out > coverage/gocov.json
@node ./scripts/gocov-to-istanbul-coverage.js ./coverage/gocov.json \
> coverage/istanbul.json
istanbul report --root ./coverage --include "**/istanbul.json" html
@Raynos
Raynos / _perf.md
Created August 26, 2016 21:49
bind allocation performance

Node 6

raynos at raynos-ThinkPad-T440p  ~/projects/temp
$ node bind-perf.js 
v8 version:  5.0.71.60
.bind() allocate time: 311
fbind() allocate time: 51
raynos at raynos-ThinkPad-T440p  ~/projects/temp
$ node bind-perf.js 
@Raynos
Raynos / relay_server.md
Last active August 29, 2015 14:24
A c relay server

libuv relay server

var LibuvTChan = require('libuv-tchannel');

var parse = new LibuvTChan();

// You get frames form the channel
parser.onFrame = onFrame;
raynos at raynos-SVS15127PXB ~/uber/tchannel/node on hyperbahn-advertise
$ npm install
npm http GET https://registry.npmjs.org/crc
npm http GET https://registry.npmjs.org/bufrw
npm http GET https://registry.npmjs.org/error
npm http GET https://registry.npmjs.org/farmhash
npm http GET https://registry.npmjs.org/hexer
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/readable-stream
raynos at raynos-SVS15127PXB ~/uber/tchannel/node on hyperbahn-advertise*
$ npm install
npm http request GET https://registry.npmjs.org/bufrw
npm http request GET https://registry.npmjs.org/crc
npm http request GET https://registry.npmjs.org/error
npm http request GET https://registry.npmjs.org/farmhash
npm http request GET https://registry.npmjs.org/hexer
npm http request GET https://registry.npmjs.org/json-stringify-safe
npm http request GET https://registry.npmjs.org/lru-cache
npm http request GET https://registry.npmjs.org/readable-stream
'use strict';
var through = require('through');
var ss = require('stream-serializer').json;
var net = require('net');
var dba = null;
var dbb = null;
function boilerplateCreateServer(db) {
var h = require("virtual-hyperscript");
// Children as arguments[2]
h("div", {
"aria-hidden": true,
"ev-click": onClick,
}, [
h("p", {
"aria-hidden": true,
'use strict';
/*usage:
```js
var IOError = require('error/io');
var fs = require('fs');
fs.readFile(fPath, function (err, file) {
if (err) {
@Raynos
Raynos / pure-widget.js
Created December 1, 2014 21:27
Example of pure widget
var createElement = require('virtual-dom/create-element.js');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var document = require('global/document');
/*
A PureWrapperWidget wraps a vnode in a container.
It can do all kinds of DOM specific logic on the
container if you wanted to. Like handling