Skip to content

Instantly share code, notes, and snippets.

View booo's full-sized avatar

Philipp Borgers booo

View GitHub Profile
@booo
booo / hs_2json.sql
Created August 26, 2011 14:24 — forked from kashif/hs_2json.sql
hstore to json function from Ilya Kosmodemiansky
CREATE FUNCTION public.hs_2json(hs hstore) RETURNS text AS $$
DECLARE
rv text;
r record;
BEGIN
rv:='';
for r in (select key, val from each(hs) as h(key, val)) loop
if rv<>'' then
rv:=rv||',';
end if;
@booo
booo / intervaltree.py
Created December 10, 2011 23:09 — forked from slomo/intervaltree.py
Implementation of intervaltree
class Node:
def __init__(self,value):
self.left = Leaf()
self.right = Leaf()
self.value = value
self.maxima = value.high
def search(tree,interval):
if interval.low > tree.maxima: