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:
I hereby claim:
To claim this, I am signing this object:
# -*- coding: utf-8 -*- | |
import json | |
import csv | |
import urllib2 | |
def load_from_url(url): | |
raw_data = urllib2.urlopen(url).read().decode('utf-8').rstrip() | |
# standardize file endings |
# 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): |
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 '[email protected]' | |
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() { |
// COMMAND + CONTROL + G --> select all matches on a page | |
// COMMAND + CLICK --> add a new cursor | |
// COMMAND + D --> select the next match | |
// COMMAND + CONTROL + UP ARROW --> move the highlighted line up | |
// COMMAND + CONTROL + DOWN ARROW --> move the highlighted line down | |
// COMMAND + SHIFT + L (over highlighted lines) --> CURSOR AT THE END OF EACH LINE | |
// COMMAND + SHIFT + P --> Opens command window for sublime | |
// CONTROL + N --> Down one line | |
// CONTROL + P --> Up one line | |
// CONTROL + F --> Forward one character |
import requests | |
import datetime | |
import time | |
import tempfile | |
from wextractor.extractors import CsvExtractor | |
upload_url = 'http://opendata.ucsur.pitt.edu/data/api/action/datastore_upsert?resource_id=eaa91ff8-6d63-4750-810a-53957a344346' | |
resource_id = 'eaa91ff8-6d63-4750-810a-53957a344346' |