This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;} | |
</style> | |
<script type="text/javascript" | |
src="https://maps.googleapis.com/maps/api/js"> | |
</script> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Canvas</title> | |
</head> | |
<body> | |
<canvas id="canvas"></canvas> | |
</body> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | |
<style type="text/css"> | |
html, body, #map { | |
margin: 0; | |
height: 100%; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytz | |
def ts_to_datetime(ts, tz="UTC"): | |
utc_dt = datetime.datetime.utcfromtimestamp(ts).replace(tzinfo=pytz.utc) | |
tz = pytz.timezone(tz) | |
dt = tz.normalize(utc_dt.astimezone(tz)) | |
return dt | |
# Reverse function is dt.timestamp() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GTFSFile(object): | |
def __init__(self, file_path): | |
self.archive = zipfile.ZipFile(file_path) | |
def get_table(self, table_name): | |
return csv.DictReader(io.TextIOWrapper(self.archive.open(table_name), "utf-8")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Piecewise(xs, ys) { | |
return function(x) { | |
//bisect | |
var lo = 0, hi = xs.length - 1; | |
while (hi - lo > 1) { | |
var mid = (lo + hi) >> 1; | |
if (x < xs[mid]) hi = mid; | |
else lo = mid; | |
} | |
//project |
NewerOlder