I hereby claim:
- I am bsmithgall on github.
- I am bsmithgall (https://keybase.io/bsmithgall) on keybase.
- I have a public key whose fingerprint is 94C0 A744 D5FF 2BCF BF5D 982F 8A33 E82F AF50 CA96
To claim this, I am signing this object:
# modified from https://gist.github.com/bsmithgall/372de43205804a2279c9 | |
SMALL_WORDS = re.compile(r'^(a|an|and|as|at|but|by|en|etc|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$', re.I) | |
SPACE_SPLIT = re.compile(r'[\t ]') | |
# taken from http://stackoverflow.com/a/267405 | |
CAP_WORDS = re.compile(r'^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$') | |
PUNC_REGEX = re.compile(r'[{}]'.format(re.escape(string.punctuation))) | |
# taken from python-titlecase: https://github.com/ppannuto/python-titlecase/blob/master/titlecase/__init__.py#L27 | |
UC_INITIALS = re.compile(r'^(?:[A-Z]{1}\.{1}|[A-Z]{1}\.{1}[A-Z]{1})+$', re.I) | |
def better_title(string): |
I hereby claim:
To claim this, I am signing this object:
library('RCurl') | |
library('RJSONIO') | |
library('igraph') | |
stations.url <- getURL('http://citibikenyc.com/stations/json') | |
dist.url <- getURL('appservices.citibikenyc.com/data2/stations.php') | |
# prep stations for kmeans clustering | |
stations.prep <- function(url) { | |
stations.json2 <- fromJSON(url, method='C') |
D3 visualization code to accompany this blog post: http://bensmithgall.com/blog/visualizing-congressional-output
# To avoid 'QVariant' is not defined error | |
from PyQt4.QtCore import * | |
import json | |
# Get all layers on the map's canvas | |
canvas = qgis.utils.iface.mapCanvas() | |
all_layers = canvas.layers() | |
# Make dictionary of election district features (individual | |
# districts) for inserting into spatial index |
UM List | |
ACRE | |
ACRE FEET OF WATER | |
ASSEMBLY | |
BAGS | |
BALE | |
BALL | |
BAR | |
BARREL | |
BASKET |
FROM python:2.7 | |
COPY . /app/ | |
WORKDIR /app | |
RUN pip install -r requirements.txt |
from unittest import TestCase | |
from mock import Mock, patch | |
class BaseTestCase(TestCase) | |
@patch('urllib2.urlopen') | |
def login_user(self, user, urlopen): | |
_email = user.email if user else 'foo@foo.com' | |
mock_open = Mock() | |
mock_open.read.side_effect = ['{"status": "okay", "email": "' + _email + '"}'] | |
urlopen.return_value = mock_open |
Speaker: Jeffrey Heer (Twitter
Raising the Bar (Chart): The Next Generation of Visualization Tools
var x = 0, backwards = false, s = 800, y = 0, up=true, | |
r=0, g=0, b=0, circleWidth = 100, mavericks=[], | |
maxR = false, maxG = false, maxB = false, fft, song, img; | |
function preload() { | |
song = loadSound('danger-zone.mp3'); | |
img = loadImage('maverick.png'); | |
} | |
function setup() { |