Skip to content

Instantly share code, notes, and snippets.

View heapwolf's full-sized avatar
🕷️
Vault of the Black Spiders

heapwolf heapwolf

🕷️
Vault of the Black Spiders
View GitHub Profile
@heapwolf
heapwolf / index.js
Last active August 29, 2015 13:56
a transform stream
var stream = require('stream')
module.exports = function(opts) {
opts = opts || { objectMode: true }
return function(fn) {
var s = new stream.Transform(opts)
s._transform = function (chunk, encoding, done) {
#!/bin/bash
(
echo "(function() {"
for i in {0..9999}; do
echo "
var var$i = 1
var read$i = function() {
// Prevent inlining by feigning recursion
if (!var$i) read$i()
@nzakas
nzakas / simplemap.js
Created April 3, 2014 17:38
A simple map implementation for JavaScript (not intended to be an ES6 polyfill)
function SimpleMap() {
this._data = {};
}
SimpleMap.prototype = {
get: function(key) {
return this.has(key) ? this._data[key] : null;
},
@heapwolf
heapwolf / net.cc
Last active August 29, 2015 14:01
/*
* To compile
*
* smpl net.cc
*
*/
#include <net>
#include <through>
/**
* Apply a function in needed environment.
* Firefox only, educational purpose only.
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
*/
Function.prototype.setEnvironment = function(environment) {
with (environment) {
return eval(uneval(this));
}
@heapwolf
heapwolf / es5check.js
Created November 29, 2010 04:30
identify ES5 functions that are not implemented in a browser (returns an object literal of arrays that contain the names of the missing functions)
var issues = (function() {
var o = {
"Array.prototype": "forEach map reduce reduceRight filter every some indexOf lastIndexOf",
"Array": "isArray",
"Object": "keys preventExtensions isExtensible getOwnPropertyDescriptor defineProperty getOwnPropertyNames create seal isSealed freeze isFrozen"
};
for(var l in o) {
o[l] = o[l].split(" ");
for(var f=0; f<o[l].length; f++) {
@heapwolf
heapwolf / arrayDiff.js
Created January 23, 2011 13:42
array diff
Array.diff = function(left, right)
{
var o = left;
var n = right;
var ns = {};
var os = {};
for (var i = 0; i < n.length; i++) {
if (ns[n[i]] == null)
@heapwolf
heapwolf / sesh.js
Created March 3, 2011 17:26
A simplified way to store script state across browser refreshes.
;(function() {
return window.sesh = {
init: function() {
var self = this;
window.addEventListener('unload', function() {
self.serialize();
}, false);
self.parse();
},
@heapwolf
heapwolf / z.js
Created February 26, 2012 18:10
z
//
// an experimental flow control library.
// please dont ever use this for anything.
//
var z = function z(f) {
if (!(this instanceof z)) {
return new z(f);
}

The ultimate database of the future

What does the ultimate database look like? Maybe the ultimate database of the future going to be a many-headed hydra that will attempt to solve all problems? Maybe marketing teams are going to be at the heart of its success? Perhaps it will grow tentacles and become violent toward its creator?

Hydra

What does your current database do?

Unless you're a contributor to the software, your probably limited to understanding the value propositions and a subset of features. Maybe your an expert. Probably not. This corner is usually dark. A database has historically been a black box. You pick one that seems like the best fit and trust it.

Maybe the database of the future should just be a library, more like BerkeleyDB, I really don't want an entire server. Someone could just add a server on top of it if they really wanted one. It would also be nice if understanding it (in its entirety) wouldn't represent a big investment.