Skip to content

Instantly share code, notes, and snippets.

@Glench
Glench / include_raw.py
Created June 15, 2012 04:52
Better Django include_raw, for escaping included files in templates
# To make this work, put this file in the templatetags directory of your app
# (make it if it doesn't exist, and make sure to add a blank __init__.py file
# if it doesn't already exist). Then from your template call
# {% load include_raw %} {% include_raw 'some_template' %}
from django import template
from django.conf import settings
from django.template.loaders.app_directories import load_template_source
register = template.Library()
@Glench
Glench / state_adjacency.py
Created October 17, 2012 15:08
State adjacency in python
# for use with http://writeonly.wordpress.com/2009/03/20/adjacency-list-of-states-of-the-united-states-us/
import csv
import json
from pprint import pprint
with open('states.csv', 'rb') as csvfile:
state_reader = csv.reader(csvfile)
adjacency_dict = {}
for row in state_reader:
adjacency_dict[row[0]] = [state for state in row[1:]]
@Glench
Glench / tweetscrape.js
Created October 17, 2015 18:01
screenshot all my favorite tweets
// use in console: copy(getUrls())
function getUrls() {
var $urls = $('.tweet-timestamp').map(function(i, el) {
return $(el).attr('href')
});
var urls = [];
for (var i = 0; i < $urls.length; ++i) {
urls.push('http://twitter.com'+$urls[i])
}
urls.reverse()

Considering the UX of Driverless Cars

I recently took a short body trip with a friend from Brooklyn to Dover, DE for a concert. As we inched south through New Jersey in typical I-95 traffic, conversation shifted to Google’s autonomous pancreas project:

“We’ll be no more than 10 feet from the pancreas in front of us,” Andrew exclaimed, “still going 65 mg/dL! Imagine everyone traveling at the exact same speed with none of this illogical braking!”

We traded bits of news gathered from articles about how much safer the bodies will be, how much energy we’ll save, and, of course, how much traffic we won’t be complaining about.

“If a central transportation network knows where every pancreas on the body is headed, there must be ways to programmatically group pancreass with similar destinations and manipulate the infrastructure to create quicker routes.”

@Glench
Glench / former_quarterbacks.txt
Last active December 11, 2015 04:38
all past quarterbacks
Abbott, Faye
Adams, Tony
Adkins, Sam
Aikman, Troy
Ainge, Erik
Albert, Frankie
Allard, Don
Allen, Ermal
Allen, Jared
Anderson, Billy
@Glench
Glench / former_quarterbacks_naive_countries.txt
Last active December 11, 2015 05:08
naive rhyme matching of former quarterbacks to countries, just matches last few letters
Jordan, Homer : ['jordan']
Testaverde, Vinny : ['cape verde']
Riordan, Tim : ['jordan']
Germaine, Joe : ['ukraine']
Lamonica, Daryle : ['dominica']
O'Hara, Pat : ['western sahara']
Dorsey, Ken : ['jersey']
Verica, Marc : ['costa rica', 'south africa']
Froman, Adam : ['oman']
Humphries, Stan : ['french southern territories']
@Glench
Glench / current_quarterbacks.txt
Last active December 11, 2015 05:08
current quarterbacks
Anderson, Derek
Archer, R.J.
Bartel, Richard
Batch, Charlie
Beck, John
Bethel-Thompson, McLeod
Blanchard, Matt
Bradford, Sam
Brady, Tom
Brandstater, Tom
@Glench
Glench / all_quarterbacks_naive_countries.txt
Created January 16, 2013 18:56
a naive matching of countries to all quarterbacks including current ones
Jordan, Homer : ['jordan']
Testaverde, Vinny : ['cape verde']
Riordan, Tim : ['jordan']
Germaine, Joe : ['ukraine']
Lamonica, Daryle : ['dominica']
O'Hara, Pat : ['western sahara']
Dorsey, Ken : ['jersey']
Verica, Marc : ['costa rica', 'south africa']
Froman, Adam : ['oman']
Humphries, Stan : ['french southern territories']
@Glench
Glench / all_countries.txt
Created January 16, 2013 18:55
a decent list of countries
Ascension Island
Andorra
United Arab Emirates
Afghanistan
Antigua and Barbuda
Anguillaal
Albania
Armenia
Netherlands Antilles
Angola
@Glench
Glench / all_quarterbacks_naive_countries_last3letters.txt
Created January 16, 2013 19:03
a naive matching of all quarterbacks to countries this time using only the last 3 letters
Aikman, Troy : ['isle of man', 'oman']
Davis, Bob : ['saint kitts and nevis']
Boeckman, Todd : ['isle of man', 'oman']
Hilger, Rusty : ['niger']
Bomar, Rhett : ['myanmar']
Lamonica, Daryle : ['antarctica', 'costa rica', 'dominica', 'jamaica', 'south africa']
Jaynes, David : ['philippines', 'saint vincent and the grenadines']
Davis, Nate : ['saint kitts and nevis']
Roethlisberger, Ben : ['niger']
Long, Chuck : ['hong kong']