A demo of Mike Bostock’s TopoJSON using states & provinces boundaries from Natural Earth.
With simplification turned on (-s 100
), this reduces the original 57MB GeoJSON file to a mere 515KB!
function p --description 'Start the best Python shell that is available' | |
set -l cmd | |
if test -f manage.py | |
if pip freeze ^/dev/null | grep -q 'django-extensions' | |
set cmd (which python) manage.py shell_plus | |
else | |
set cmd (which python) manage.py shell | |
end | |
else |
import os | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' #not using env.put as that does not execute immediately | |
from django.conf import settings | |
SessionStore = __import__(settings.SESSION_ENGINE, fromlist=['']).SessionStore | |
class DjangoSessionWSGIMiddleware(object): | |
transform = false #doesn't transform output of anything above in the stack | |
def __init__(self, app): | |
self.app = app |
A demo of Mike Bostock’s TopoJSON using states & provinces boundaries from Natural Earth.
With simplification turned on (-s 100
), this reduces the original 57MB GeoJSON file to a mere 515KB!
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
import os | |
from ginkgo import Service | |
from ginkgo.async.gevent import WSGIServer | |
from geventwebsocket.handler import WebSocketHandler | |
from flask import Flask, render_template | |
class WebSocket(Service): | |
def __init__(self): | |
self.add_service(WSGIServer(('127.0.0.1', 8001), self.handle, | |
handler_class=WebSocketHandler)) |
.DS_Store |
# Public Domain, i.e. feel free to copy/paste | |
# Considered a hack in Python 2 | |
import inspect | |
def caller_name(skip=2): | |
"""Get a name of a caller in the format module.class.method | |
`skip` specifies how many levels of stack to skip while getting caller | |
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc. |
#!/usr/bin/env python | |
import urlparse | |
import mimetypes | |
import os | |
import ConfigParser | |
import urllib2 | |
import json | |
import csv | |
import time |
function fitProjection(projection, data, box, center) { | |
// get the bounding box for the data - might be more efficient approaches | |
var left = Infinity, | |
bottom = -Infinity, | |
right = -Infinity, | |
top = Infinity; | |
// reset projection | |
projection | |
.scale(1) | |
.translate([0, 0]); |
#!/usr/bin/python | |
import subprocess | |
import re | |
from optparse import OptionParser | |
def git_version(): | |
p = subprocess.Popen(["git", "log" , '-1', '--date=iso'], stdout=subprocess.PIPE) | |
out, err = p.communicate() | |
m = re.search('\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}', out) |