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> | |
<title>311 Density</title> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="https://github.com/CloudMade/Leaflet/raw/master/dist/leaflet.css" /> | |
<!--[if lte IE 8]><link rel="stylesheet" href="https://github.com/CloudMade/Leaflet/raw/master/dist/leaflet.ie.css" /><![endif]--> | |
</head> | |
<body> |
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
from sys import argv | |
from shapely.ops import polygonize | |
from shapely.geometry import asShape, LineString | |
import json | |
if __name__ == '__main__': | |
input = argv[1] | |
input = json.load(open(input)) |
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 latLngToCoords(zoom,lat,lon) { | |
var n = Math.pow(2,zoom); | |
var lat_rad = lat * (Math.PI / 180); | |
var x_coord = n * ((lon + 180) / 360); | |
var y_coord = .5 * n * (1 - (Math.log (Math.tan(lat_rad) + (1/Math.cos(lat_rad))) / Math.PI)); | |
return {x: Math.floor(x_coord), y: Math.floor(y_coord)}; |
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
// Load d3 | |
var val_arr = []; | |
function sortFunction(a,b) { | |
return a - b; | |
} | |
function loadData(){ | |
d3.csv('data.csv',function(data){ |
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
var LambertProjection = function(lat0, lon0, lat1, lat2, xmin, ymin, xmax, ymax) | |
{ | |
var pi = Math.PI, ln = Math.log, pow = Math.pow, | |
sin = Math.sin, cos = Math.cos, tan = Math.tan, | |
atan = Math.atan, sqrt = Math.sqrt; | |
function sec(t) { return 1 / cos(t); } | |
function cot(t) { return 1 / tan(t); } | |
function deg2rad(deg) { return pi * deg / 180; } |
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
var π = Math.PI; // uni_pi = '\u03C0'; | |
console.log(π); | |
// >> 3.141592653589793 |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
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
from sys import argv | |
from time import time | |
from glob import glob | |
from os import stat, kill, getuid | |
from os.path import basename, dirname, join | |
from datetime import datetime | |
from random import choice | |
from signal import SIGTERM | |
if __name__ == '__main__': |
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> | |
<title>Animated Sparkline</title> | |
<script src="http://mbostock.github.com/d3/d3.js?2.7.2"></script> | |
<style type="text/css"> | |
path { | |
stroke: steelblue; | |
stroke-linecap: round; |
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
# Finding duplicates in a list | |
import collections | |
the_list = [2,2,2,1,1,0] | |
count = collections.Counter(the_list) |
OlderNewer