I hereby claim:
- I am rmg on github.
- I am rmg (https://keybase.io/rmg) on keybase.
- I have a public key whose fingerprint is 3DDA 2C71 32C7 89E3 5849 7086 1CCC AB43 A1FA 2211
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#include <errno.h> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <signal.h> | |
#if 0 | |
#include <stdio.h> | |
#define print1 printf | |
#define print2 printf | |
#else |
# Inspiring DSL for temp directories | |
Dir.mktmpdir {|dir| | |
# use the directory... | |
open("#{dir}/foo", "w") { ... } | |
} | |
# Provide the same ergonomics for databases | |
mktmpio(:postgres) {|db| | |
pg.connect(db) {|conn| | |
# use the database... |
const https = require('https'); | |
const bufSym = Symbol(); | |
https.get('https://nodejs.org/dist/index.json', onResponse); | |
function onResponse(res) { | |
// monkey patch using our Symbol as a key | |
res[bufSym] = ''; | |
// event emitters invoke handlers using emitter as 'this' | |
res.on('data', accumulate); |
'use strict'; | |
var fmt = require('util').format; | |
var net = require('net'); | |
module.exports = testConnection; | |
if (require.main !== module) { | |
return; | |
} |
Idea:
A simple shorthand for foo.bar.bind(foo, ...)
to make it nicer to work with partial function application.
// shorthand
function sillyClone(input) {
var acc = [];
input.forEach(acc.push&());
return acc;
git clone [email protected]:35d39ab94e659bff436fca096f2c5e37.git bowling
cd bowling
npm install
npm test
// original Promise-only version. I try to write my functions to be pure | |
// when appropriate so that they are composable in to promise chains like | |
// this | |
function findOrCreateUser(id /* :string */, user /* :User */) /* :Promise<User> */ { | |
return db.users | |
.hsetnx(id, 'created_at', user.created_at.toJSON()) | |
.then(function(isNew) { | |
if (isNew) { | |
logger.info({user: user}, 'New user'); | |
return db.users.hmset(id, serializeUser(user)) |
# Print tab-separated details for the given file based on the package that owns it | |
# Usage: | |
# awk -v file=/path/to/some/file -f find.awk /lib/apk/db/installed | |
BEGIN { | |
# multi-line records, go! | |
RS="" | |
# our input fields are lines, but our output is tab-delimited | |
OFS="\t" | |
These are hexdumps of the tarball added in isaacs/node-tar#187
gnu-tar
from gtar -cf ...
gnu-posix-tar
from gtar --posix -cf ...
bsd-tar
from bsdtar -cf ...
edit: I've added additional line breaks at the 512 byte boundaries to make it easier to see the tar framing.