View cool.js
var column = require('column-mesh')
var mesh = column()
module.exports = function (regl) {
return regl({
frag: ``,
vert: ``,
//...
})
}
View column.js
var surface = require('isosurface').surfaceNets
var vec3 = require('gl-vec3')
var mat4 = require('gl-mat4')
var length = vec3.length, sub = vec3.subtract
var max = vec3.max, min = vec3.min, dot = vec3.dot
var abs = elwise(Math.abs), sqrt = elwise(Math.sqrt)
function elwise (f) {
return function (out, v) {
View hsl2rgb.glsl
vec3 hsl2rgb(in float h, float s, float l) {
vec3 rgb = clamp( abs(mod(h*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );
return l + s * (rgb-0.5)*(1.0-abs(2.0*l-1.0));
}
View index.js
var db = ....
exports.users = function (cb) {
// ...
// at some point, cb(null, users) or cb(err)
}
exports.createUser = require('./create_user.js')
View compile.js
var browserify = require('browserify')
var fs = require('fs')
var concat = require('concat-stream')
var createHash = require('crypto').createHash
var b = browserify('main.js').bundle()
var pending = 2, hash = null
b.pipe(fs.createWriteStream('bundle.js'))
.once('finish', done)
View grid.js
var PI = Math.PI
var sin = Math.sin, asin = Math.asin
module.exports = function compute (opts) {
var nx = opts.xcount
var ny = opts.ycount
var xmin = opts.xmin
var xmax = opts.xmax
var ymin = opts.ymin
var ymax = opts.ymax
View scrub.js
#!/usr/bin/env node
var minimist = require('minimist')
var argv = minimist(process.argv.slice(2), {
alias: { i: 'ignore' },
string: [ 'ignore' ]
})
var to = require('to2')
var ignore = [].concat(argv.ignore)
var osmdb = require('osm-p2p')
View hmac_capability_system.md

hmac capability system

We can use HMACs to implement a distributed capability system.

var crypto = require('crypto')

var rootkey = crypto.randomBytes(32)
var propkey1 = hmac(rootkey, 'propname1')
var propkey2 = hmac(rootkey, 'propname2')
View hyperdrive.js
var level = require('level')
var hyperdrive = require('hyperdrive')
var db = level('/tmp/whatever.db')
var drive = hyperdrive(db)
var link = Buffer(process.argv[4], 'hex')
var archive = drive.createArchive(link, { live: true })
//console.log(archive.key.toString('hex'))
if (process.argv[2] === 'write') {
View digest.js
var hyperdrive = require('hyperdrive')
var memdb = require('memdb')
var drive = hyperdrive(memdb())
var archive = drive.createArchive({ live: true })
console.log(archive.key.toString('hex')) // stays the same
var digests = {}
commit0(function () {
commit1(function () {