Skip to content

Instantly share code, notes, and snippets.

View sconnelley's full-sized avatar

Sean Connelley sconnelley

View GitHub Profile
@sconnelley
sconnelley / index.html
Created March 14, 2014 23:12
Fitting D3 map inside a viewport and constrain panning.
<!DOCTYPE html>
<html lang="en">
<head>
<title>d3 geo map</title>
<meta charset="utf-8">
<style>
svg {
border: 1px solid #ccc;
}
@sconnelley
sconnelley / simple-marker.js
Created April 18, 2014 17:41
Google simple marker
/*
Simple Google Markers
ex: var marker = new stamen.simpleMarker(map,latlng);
*/
(function(exports) {
var stamen = exports.stamen || (exports.stamen = {});
stamen.simpleMarker = function(map, latlng) {
@sconnelley
sconnelley / gist:23dd7d6e7314cbdcb0b3
Created July 14, 2014 16:04
Mercator Projection, from Google with Google-ly bits removed.
var Mercator = (function(){
/**
Mercator Projection
ref: https://developers.google.com/maps/documentation/javascript/examples/map-coordinates?csw=1
**/
function MercatorProjection(tileSize) {
this.tileSize = tileSize || 256;
this.ONE_DEGREE = Math.PI / 180;
@sconnelley
sconnelley / mapreduce.py
Last active August 29, 2015 14:04
Python parser for maps.stamen.com log files
# Parses maps.stamen.com log files
# 99% of the code comes from http://pymotw.com/2/multiprocessing/mapreduce.html
# Another useful article can be found here, http://effbot.org/zone/wide-finder.htm
# Per file processing time could be improved with threads I imagine
# roughly 2k-3k files totaling ~ 150mb takes about 30min
"""
Usage:
1. Download log files from s3 into local dated directories with your weapon of choice.
@sconnelley
sconnelley / gist:4d59fe001674d2191bbb
Last active August 29, 2015 14:05
Modifies Leaflet.js to allow for extra pathRoots.
/*
* modifies Leaflet to allow for extra pathRoots, "main" & "evts".
* seems to work in 0.7.3, partially updated the code below
* Have not tested it for canvas support, VML seems ok
* TODO: Create more dynamic way to add 'pathRoots'
*/
/*
USAGE:
1. Include this file after leaflet.js
@sconnelley
sconnelley / gist:a5142dd2de7c6734b51d
Last active August 29, 2015 14:11
ImageMapType attribution for maps.stamen.com
// Adds attribution for maps.stamen.com tiles to Google maps
// You will need to add these CSS styles
/*
#stamen-maps-attribution {
font-family: Roboto, Arial, sans-serif;
z-index: 1;
}
#stamen-maps-attribution > div {
background-color: rgb(245, 245, 245);
opacity: 0.7;
@sconnelley
sconnelley / jsonp.js
Created February 9, 2016 17:37 — forked from gf3/jsonp.js
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@sconnelley
sconnelley / Makefile.config
Last active May 28, 2018 21:34
Install Caffe (w/o GPU) on OS X El Capitan (10.11.6) using Homebrew Python (2.7.12_2)
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers