Skip to content

Instantly share code, notes, and snippets.

View babakness's full-sized avatar

Babak B. babakness

View GitHub Profile
@babakness
babakness / README.md
Created June 21, 2017 06:18 — forked from benjie/README.md
Easy plv8 on OSX

Heroku runs plv8 v1.4.2 (checked on 1st April 2016). On OSX it's easiest to install v1.4.3 since that allows V8 3.15 which is available via homebrew. (1.4.2 wants V8 3.14.5).

To install:

brew install v8-315
pip install pgxnclient
LIBRARY_PATH="/usr/local/opt/v8-315/lib" CPATH="/usr/local/opt/v8-315/include" pgxnclient install plv8=1.4.3
@babakness
babakness / README.md
Created June 21, 2017 06:18 — forked from benjie/README.md
Easy plv8 on OSX

Heroku runs plv8 v1.4.2 (checked on 1st April 2016). On OSX it's easiest to install v1.4.3 since that allows V8 3.15 which is available via homebrew. (1.4.2 wants V8 3.14.5).

To install:

brew install v8-315
pip install pgxnclient
LIBRARY_PATH="/usr/local/opt/v8-315/lib" CPATH="/usr/local/opt/v8-315/include" pgxnclient install plv8=1.4.3
@babakness
babakness / plv8-modules.sh
Created June 22, 2017 02:52 — forked from daviddahl/plv8-modules.sh
plv8-modules
#! /bin/bash
sudo apt-get install npm
cd /var/django
npm install moment moment-timezone
sudo -u postgres psql -d template1 -c "create extension plv8;"
sudo -u postgres psql -d template1 << EOF
@babakness
babakness / Firebase Database API Cheatsheet
Created January 16, 2018 03:33 — forked from odigity/Firebase Database API Cheatsheet
Firebase Database API Cheatsheet
There is no way to store an empty object/array/null value.
There are also no actual arrays. Array values get stored as objects with integer keys.
(If all keys are integers, it will be returned as an array.)
Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.
── Classes ──
DataSnapshot : Container for a subtree of data at a particular location.
@babakness
babakness / stdlib.ts
Created June 30, 2018 05:35 — forked from KiaraGrouwstra/stdlib.ts
Type-level standard library for TypeScript
// NOTE: code now moved to https://github.com/tycho01/typical
// older revision left here, but it no longer runs well in TS Playground
export type Obj<T> = { [k: string]: T };
export type NumObj<T> = { [k: number]: T };
// export type List = ArrayLike; // no unapplied generic types :(
export type List<T> = ArrayLike<T>;
// progress: https://github.com/Microsoft/TypeScript/issues/16392
export function force<T, V extends T>() {}
@babakness
babakness / caselessDictionary.py
Created October 16, 2012 18:46 — forked from bloomonkey/caselessDictionary.py
A Python dictionary sub-class that is case-insensitive when searching, but also preserves the keys as inserted.
class CaselessDictionary(dict):
"""Dictionary that enables case insensitive searching while preserving case sensitivity
when keys are listed, ie, via keys() or items() methods.
Works by storing a lowercase version of the key as the new key and stores the original key-value
pair as the key's value (values become dictionaries)."""
def __init__(self, initval={}):
if isinstance(initval, dict):
for key, value in initval.iteritems():