This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"bytes" | |
) | |
const ( | |
FLT = iota | |
INT = iota |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns shortener.handler | |
(:use compojure.core) | |
(:require [compojure.handler :as handler] | |
[compojure.route :as route] | |
[clojure.java.jdbc :as j])) | |
(def db | |
{:classname "org.sqlite.JDBC" | |
:subprotocol "sqlite" | |
:subname "db/database.db" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\* PEG js grammar for graphite functions *\ | |
start = EXPRS | |
TARGET = target:[^\(\), ]+ { | |
return { | |
'type': 'target', | |
'data': target.join(''), | |
'children': null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deprecated(f): | |
def wrapped(*args, **kwargs): | |
print "{func} is DEPRECATED!".format(func=f.__name__) | |
return f(*args, **kwargs) | |
return wrapped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import furl | |
import json | |
from operator import itemgetter | |
class BaseApi(object): | |
def __init__(self, host): | |
self.host = host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import furl | |
import json | |
class DescartesException(Exception): | |
pass | |
class DescartesApi(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class DirectoryScope(object): | |
def __init__(self, new_directory): | |
self.old_directory = os.path.abspath(os.getcwd()) | |
self.new_directory = os.path.abspath(new_directory) | |
def __enter__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
diff_re = re.compile( | |
"@@ \-(?P<removed_start>\d+),(?P<removed_length>\d+) " | |
"\+(?P<added_start>\d+),(?P<added_length>\d+) @@" | |
) | |
class DiffContext: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
import socket | |
import struct | |
import pickle | |
class GraphiteClient: | |
def __init__(self, | |
graphite_host='localhost', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
def version_compare(comparer): | |
def compare_from(v1): | |
def compare_to(v2): | |
return comparer(map(int, v1.split(".")), | |
map(int, v2.split("."))) and \ | |
not any(v2.endswith(e) for e in ["beta", "alpha"]) | |
return compare_to | |
return compare_from |