Skip to content

Instantly share code, notes, and snippets.

extern crate time;
extern crate rocksdb;
extern crate rand;
use rand::prelude::*;
const NODES: u64 = 10000000;
const KEY_LENGTH: usize = 30;
const DATA_LENGTH: usize = 200;
View daemon.js
'use strict'
var EventEmitter = require('events')
var electronEval = require('electron-eval')
var watt = require('watt')
class Daemon extends EventEmitter {
constructor (opts) {
this.daemon = electronEval(opts)
View funnel.js
var extrude = require('extrude-by-path')
var matScale = require('gl-mat4/scale')
var toStl = require('serialize-stl')
function createCirclePath (r, fn) {
var circle = []
for (var i = 0; i <= fn; i++) {
var theta = Math.PI*2/fn*i
circle.push([r * Math.cos(theta), r * Math.sin(theta), 0, theta + 0.15])

Keybase proof

I hereby claim:

  • I am mappum on github.
  • I am mappum ( on keybase.
  • I have a public key ASAnYrDZQA4Hnziay_XGDFlCIhfUCgLLgI6Mv9Z_7VU6cgo

To claim this, I am signing this object:

View gist:ee1e1ea92f4334df0530
Bot is initialized. HEAD: 192b96a98368f547dce6855800a955bd72554136
var voteFileName = '' + PR.head.repo.own
ReferenceError: PR is not defined
at handlePR (/home/bot/botwillacceptanything/voting.js:101:63)
at Array.forEach (native)
at /home/bot/botwillacceptanything/main.js:85:9
at /home/bot/botwillacceptanything/node_modules/github/api/v3.0.0/pullRequests.js:64:17
at IncomingMessage.<anonymous> (/home/bot/botwillacceptanything/node_modules/github/index.js:782:21)
View Makefile
vmname="PXE Booter"
define notfound
$(iso) not found
make sure the daemon is running and mounted:
ipfs daemon &
ipfs mount
export notfound
mappum / gist:19b5f12edd001b33a72f
Last active Aug 29, 2015
Type-checking annotation in vanilla Javascript
View gist:19b5f12edd001b33a72f
// It's possible to add your own quasi language constructs in JS using comments and Function#toString.
// (Doesn't survive minification)
// (You might need to modularize the execution of the annotations)
function checkType(f) {
return function(a) {
var type = f.toString().match(/\/\/(.*)\n/)[1].trim();
if(type !== typeof(a)) throw new Error('Invalid type');
return f(a);
Facebook Hacker Cup Qualifications - Problem 3
# takes in two strings of input, and returns the nth value of m
f = (input1, input2) ->
# parse the input strings to get the variable values
split = input1.split ' '
n = Number split[0]
View comment.js
var Schema = require('mongoose').Schema,
ObjectId = Schema.ObjectId,
Transaction = require('./transaction.js');
var Comment = module.exports = new Schema({
'author': String,
'body': String,
'date': Date,
'parent': ObjectId,
View gist:2773542
throw e; // process.nextTick error, or 'error' event on first tick
TypeError: Cannot read property 'states' of undefined
at EmbeddedDocument.isDirectModified (/home/mappum/aptt/node_modules/mongoose/lib/document.js:673:36)
at EmbeddedDocument.set (/home/mappum/aptt/node_modules/mongoose/lib/document.js:417:17)
at EmbeddedDocument.parent (/home/mappum/aptt/node_modules/mongoose/lib/document.js:993:45)
at EmbeddedDocument.EmbeddedDocument (/home/mappum/aptt/node_modules/mongoose/lib/types/embedded.js:19:15)
at new EmbeddedDocument (/home/mappum/aptt/node_modules/mongoose/lib/schema/documentarray.js:26:17)
at DocumentArray.SchemaArray (/home/mappum/aptt/node_modules/mongoose/lib/schema/array.js:48:19)