Skip to content

Instantly share code, notes, and snippets.

View gka's full-sized avatar
🐢

Gregor Aisch gka

🐢
View GitHub Profile
@dill
dill / example.R
Created February 20, 2016 20:23
display R plots in iTerm2
library(ggplot2)
library(emoGG)
source("imgcat.R")
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_emoji(emoji="1f337")
imgcat(print(p))
dayLength = 24 * 60 * 60 * 1000
beforeMidnight = (dayLength - 1)
endDate = (year, month, day) ->
date = new Date(year, parseInt(month or 1)-1, day or 1)
return new Date(date.getTime() + beforeMidnight)
exports.parseDate = (dateString) ->
@pudo
pudo / nomenklatura.sql
Created February 19, 2013 12:15
Postgres Nomenklatura Client
CREATE OR REPLACE FUNCTION nomenklatura (key text, dataset text, api_key text)
RETURNS text
AS $$
import json, urllib, urllib2
url = 'http://nomenklatura.okfnlabs.org/%s/lookup?' % dataset
url += urllib.urlencode({'api_key': api_key, 'key': key})
req = urllib2.Request(url, None, {'Accept': 'application/json'})
try: