Skip to content

Instantly share code, notes, and snippets.

View 19h's full-sized avatar
✔️
This account is verified.

Kenan Sulayman 19h

✔️
This account is verified.
View GitHub Profile
@19h
19h / index.js
Last active January 1, 2016 15:39 — forked from max-mapper/index.js
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
@19h
19h / gist:7902582
Created December 10, 2013 23:53 — forked from mikeal/gist:7897206

Children are created, raised, cared for and we hope that they will live a long and proud life only to end long after their creator's has ended. They are their creator's legacy.

Your code is not your child, it is an animal raised for slaughter. Your code will die. It will die before your death. Your code's entire purpose is to die. Your code enables some new function and if successful that new function will grow, it will mature, it will eventually outlive the usefullness you've provided. When successful your code creates value that outlives it and the faster the better. When unsuccessful a mercy killing is most appropriate.

Believing that our code is our children makes us territorial, protective. Nobody is allowed to kill it, only improve it. The idea that our code can be perfect, that it can change to handle so many new concerns leads to the birth of frameworks and plugin systems. These systems brutalize creativity by forcing new value to conform to the standards of our aging children.

@19h
19h / readDictionary.js
Last active December 20, 2015 20:08 — forked from AndrewRayCode/gist:825583
Recursive directory walker / indexer / lister with array, object-stat hashmap and joint-mode support. For V8/Node.js, in Javascript.
/*
__ ___
/\ \ __ /'___\
\ \ \ __ __ /\_\/\ \__/ __ __
\ \ \ __ /'__`\ /'_ `\/\ \ \ ,__\/\ \/\ \
\ \ \L\ \/\ __//\ \L\ \ \ \ \ \_/\ \ \_\ \
\ \____/\ \____\ \____ \ \_\ \_\ \/`____ \
\/___/ \/____/\/___L\ \/_/\/_/ `/___/> \
/\____/ /\___/
\_/__/ \/__/