Skip to content

Instantly share code, notes, and snippets.

View morganherlocker's full-sized avatar
☠️
computing

Morgan Herlocker morganherlocker

☠️
computing
View GitHub Profile
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Map with WMS</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css">
{
"type": "FeatureCollection",
"features": [...],
"legend": {
"title": "Population Quantiles",
"symbols": [
{"from": 0, "to": 10, "color": "ffffff", "symbol": "square"},
{"from": 10, "to": 50, "color": "cffff1", "symbol": "square"},
{"from": 50, "to": 80, "color": "afff33", "symbol": "square"}
]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@morganherlocker
morganherlocker / index.js
Created May 23, 2014 19:28
requirebin sketch
var domify = require('domify')
var insertCSS = require('insert-css')
var d3 = require('d3')
var data = [4, 8, 15, 18, 23, 42, 10, 60, 30];
var css = ''
var html = '<div id="chart">chart</div>'
insertCSS(css)
@morganherlocker
morganherlocker / index.js
Created June 3, 2014 21:25
requirebin sketch
var domify = require('domify')
var html = "<canvas id='display' width='1' height='1' style='width: 100%; height: 100%;' />"
document.body.appendChild(domify(html))
var CIRCLE = Math.PI * 2;
var MOBILE = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)
function Controls() {
@morganherlocker
morganherlocker / index.js
Created June 3, 2014 21:29
requirebin sketch
var domify = require('domify')
var html = "<canvas id='display' width='1' height='1' style='width: 100%; height: 100%;' />"
document.body.appendChild(domify(html))
var CIRCLE = Math.PI * 2;
var MOBILE = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)
function Controls() {
@morganherlocker
morganherlocker / index.js
Created June 4, 2014 13:55
requirebin sketch
var tin = require('turf-tin');
var d3 = require('d3');
var domify = require('domify');
var point = require('turf-point');
var inside = require('turf-inside');
var planepoint = require('turf-planepoint');
// setup
var html = '<div id="res">Elevation:</div>';
document.body.appendChild(domify(html));
@morganherlocker
morganherlocker / index.js
Created June 4, 2014 19:58
requirebin sketch
var domify = require('domify');
var THREE = require('three')
var html = '<style>canvas { width: 100%; height: 100% }</style>'
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);