Skip to content

Instantly share code, notes, and snippets.

View benchmark.md
raynos at raynos-ThinkPad-T440p  
~/gocode/src/github.com/uber/zanzibar on master*
$ go test -benchmem -cpu 2 -bench . ./wut_test.go 
testing: warning: no tests to run
BenchmarkClosure-2   	10000000	       113 ns/op	      64 B/op	       2 allocs/op
BenchmarkStruct-2    	10000000	       129 ns/op	      64 B/op	       2 allocs/op
PASS
ok  	command-line-arguments	2.684s
View static_config.go
package staticConfig
import (
"io/ioutil"
"reflect"
"encoding/json"
"github.com/buger/jsonparser"
"github.com/pkg/errors"
View Makefile
# 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 Aug 26, 2016
bind allocation performance
View _perf.md

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 Aug 29, 2015
A c relay server
View relay_server.md

libuv relay server

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

var parse = new LibuvTChan();

// You get frames form the channel
parser.onFrame = onFrame;
View spurious-402.txt
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
View npm-retries.txt
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
View magic.js
'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) {
View virtual-hyperscript-children.js
var h = require("virtual-hyperscript");
// Children as arguments[2]
h("div", {
"aria-hidden": true,
"ev-click": onClick,
}, [
h("p", {
"aria-hidden": true,
View io-error.js
'use strict';
/*usage:
```js
var IOError = require('error/io');
var fs = require('fs');
fs.readFile(fPath, function (err, file) {
if (err) {
You can’t perform that action at this time.