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!
| var landGrid = [ | |
| { | |
| "X": "1", | |
| "Y": "1" | |
| }, | |
| { | |
| "X": "1", | |
| "Y": "2" | |
| }, | |
| { |
| from collections import deque | |
| from functools import wraps | |
| def inversify(predicate): | |
| """Returns a predicate that is the inverses of the given predicate.""" | |
| @wraps(predicate) | |
| def _inner(*args, **kwargs): | |
| return not predicate(*args, **kwargs) | |
| return _inner |
| 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 |