Skip to content

Instantly share code, notes, and snippets.

@lukeburns
lukeburns / install.sh
Created August 19, 2016 23:57
Install a package from npm with a dedicated node binary
#!/usr/bin/env bash
{
IFS=@ read CMD VERSION <<< "$1";
curl https://raw.githubusercontent.com/isaacs/nave/master/nave.sh | bash -s use $1 latest eval "detect_profile() {
if [ -n \"\$PROFILE\" -a -f \"\$PROFILE\" ]; then
echo \"\$PROFILE\"
return
fi
local DETECTED_PROFILE
@lukeburns
lukeburns / init.js
Last active July 23, 2016 23:01
self-reloading atom init file
var fs = require('fs')
atom.notifications.addInfo('loaded 0')
function onclose () {
atom.notifications.addInfo('closed 0')
}
var watch = fs.watch(__filename, function once () {
delete require.cache[__filename]
@lukeburns
lukeburns / dat-pipe.js
Last active June 21, 2016 08:26
stream hypercore feeds over stdin/stdout
#!/usr/bin/env node
var minimist = require('minimist')
var memdb = require('memdb')
var hypercore = require('hypercore')
var createSwarm = require('hyperdrive-archive-swarm')
var opts = require('minimist')(process.argv.splice(2), { alias: { s: 'static', l: 'live' } })
var key = opts._[0]
delete opts._
@lukeburns
lukeburns / discovery_service.js
Last active June 20, 2016 22:47
a public discovery service for decentralized feeds of public keys
// this is a prototype for a web service that publishes a feed of public keys and metadata onto a p2p network.
// keys and metadata are appended to the feed if and only if they are properly signed.
// that is, for a public key to be on the feed, the owner must have given permission (and this is verifiable).
// the code below is solely concerned with exposing an api over http.
var http = require('http')
var qs = require('querystring')
// this is a feed that replicates itself on the hypercore network
// and only appends properly signed feeds
# The first step is to import the required packages. The aliases `plt` and
# `np` are coding conventions.
# * `Axes3D` allows adding 3d objects to a 2d matplotlib plot.
# * The `pyplot` submodule from the **matplotlib** library, a python 2D
# plotting library which produces publication quality figures.
# * The `numpy` library for efficient numeric-array manipulation
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
@lukeburns
lukeburns / render.js
Last active January 11, 2018 19:24
server-side KaTeX rendering
var katex = require('./katex')
, fs = require('fs')
, Canvas = require('canvas')
, canvas = new Canvas(150, 150)
, ctx = canvas.getContext('2d')
, fs = require('fs');
try {
// Prepare box to get its dimensions
var box = katex.canvasBox('(\\left( x \\right) \\left( x^2 \\right) \\left( \\frac{a}{b} \\right) \\left( \\frac{a^2}{b} \\right) \\left( \\dfrac{a}{b} \\right) \\left( \\dfrac{a^2}{b} \\right)', ctx, {
@lukeburns
lukeburns / gist:8728a6186611a64b06c6
Last active August 29, 2015 14:23 — forked from schacon/gist:1
the meaning of gist
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
@lukeburns
lukeburns / keybase.md
Created February 25, 2015 13:34
keybase.md

Keybase proof

I hereby claim:

  • I am lukeburns on github.
  • I am lukeburns (https://keybase.io/lukeburns) on keybase.
  • I have a public key whose fingerprint is 7F13 7C6A AB3A 32CF FBB4 DA9A 60E4 151E 7104 6C21

To claim this, I am signing this object:

resume settings
/usr/local/lib/node_modules/resume-cli/index.js:124
lib.settings(program);
^
TypeError: undefined is not a function
at /usr/local/lib/node_modules/resume-cli/index.js:124:17
at /usr/local/lib/node_modules/resume-cli/index.js:21:17
at fs.js:291:14
at Object.oncomplete (fs.js:97:15)
# app.js
// List
Template.list.list = function() {
return Lists.findOne({ _id: Session.get('listId') });
};
Template.list.items = function() {
return Items.find({ list_id: Session.get('listId') }).fetch();
}