Skip to content

Instantly share code, notes, and snippets.

Jake Verbaten Raynos

Block or report user

Report or block Raynos

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 x.ts
export class ValidationFail {
readonly validateErr: string
readonly ok: false
constructor(validateErr: string) {
this.validateErr = validateErr
this.ok = false
}
}
export class ValidationSuccess<T> {
View x.sh
$ npm pack @pre-bundled/tape@5.0.0 | wc -l
npm http fetch GET 200 https://registry.npmjs.org/@pre-bundled%2ftape 13ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/@pre-bundled%2ftape 5ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/@pre-bundled/tape/-/tape-5.0.0.tgz 3ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/@pre-bundled/tape/-/tape-5.0.0.tgz 59ms (from cache)
npm notice
npm notice 📦 @pre-bundled/tape@5.0.0
npm notice === Tarball Contents ===
npm notice 17B pre-bundled/node_modules/dotignore/test/.1-ignore
npm notice 468B .editorconfig
View gist:6f83a548374ba9a243f3b0b82a5102ed
1 import fs, { readFileSync } from 'fs';
2 import { syncBuiltinESMExports, createRequire } from 'module';
3
4 const require = createRequire(import.meta.url)
5 const { readFileSync: readFileSync2 } = require('fs')
6
7 var ref = readFileSync
8
9 console.log('import', readFileSync)
10 console.log('var ok ?', ref)
View x.js
class DataTableExample extends DataTable {
computeRowValues (row) {
return [
row.message,
new Date(row.timestamp).toGMTString()
]
}
computeRowHeaders () {
View json-logger.js
'use strict'
const pino = require('pino')
const os = require('os')
const { modes } = require('./logger.js')
/**
* This class gives an improved interface for pino
*
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;
You can’t perform that action at this time.