Skip to content

Instantly share code, notes, and snippets.

View morganherlocker's full-sized avatar
☠️
computing

Morgan Herlocker morganherlocker

☠️
computing
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@morganherlocker
morganherlocker / README.md
Last active August 29, 2015 13:56
Geocolor Choloropleth with simplestyle-spec Styling

sc_poverty_unstyled.geojson contains South Carolina's counties, with a poverty index. To create a choloropleth viewable in a gist, we can use geocolor.

var fs = require('fs'),
    geocolor = require('geocolor')

var geo = JSON.parse(fs.readFileSync(__dirname+'/in/sc_pov.geojson'))

geo = geocolor(geo, 'poverty', 'quantile', 7, ['blue', 'red'])
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@1.4.6
3 info using node@v0.10.26
4 verbose publish [ '.' ]
5 verbose cache add [ '.', null ]
6 verbose cache add name=undefined spec="." args=[".",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@1.4.6
3 info using node@v0.10.26
4 verbose publish [ '.' ]
5 verbose cache add [ '.', null ]
6 verbose cache add name=undefined spec="." args=[".",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,

Update a donut chart extent based on a dragged brush extent

var melody = [22,18,8,6,18,20,24,26,20,18,12,18]
return function (t) {
t = t/1.28
return drums1(t)/4 + drums2(t)/2.4 + drums3(t)/18 + synth1(t) + synth2(t);
}
function sin (x, t) { return Math.sin(2 * Math.PI * t * x *.6) * 1.5 }
var melody = [22,18,8,6,18,20,24,26,20,18,12,18,32,32,33,33,34,36,40,48,2,0,2,0,-32,-12,10,64]
return function (t) {
t = t/1.28
return drums1(t)/.05 + drums2(t)/.01 + drums3(t)/.043 + synth1(t)*400 + synth2(t)*280;
}
function sin (x, t) { return Math.sin(2 * Math.PI * t * x *.6) * 1.5 }
@morganherlocker
morganherlocker / unixy_gis.md
Created April 14, 2014 15:32
hypothetical gis cli

unixy gis

Create a 5 mile buffer around all households, merge the polygons, and output a geojson file representing populated areas.

cat households.geojson |
turf_buffer --distance 5 --units "miles" |
turf_merge >
populated_areas.geojson