Skip to content

Instantly share code, notes, and snippets.

@Grace
Grace / .block
Created December 6, 2016 07:14 — forked from mbostock/.block
Graph Rollup
license: gpl-3.0
@Grace
Grace / redditbot.md
Created July 6, 2016 02:44 — forked from aggrolite/redditbot.md
Writing a reddit bot with Go and OAuth2
@Grace
Grace / gnuize.sh
Created March 24, 2016 09:49 — forked from clayfreeman/gnuize.sh
GNU-ize Mac OS X El Capitan
#!/bin/bash
# Install required packages from Homebrew
brew tap homebrew/dupes
brew install coreutils binutils diffutils ed findutils gawk gnu-indent gnu-sed \
gnu-tar gnu-which gnutls grep gzip screen watch wdiff wget bash gdb gpatch \
m4 make nano file-formula git less openssh python rsync svn unzip vim \
--default-names --with-default-names --with-gettext --override-system-vi \
--override-system-vim --custom-system-icons
brew cleanup
@Grace
Grace / premorph.js
Created March 15, 2016 01:44 — forked from veltman/premorph.js
Morph pre-processing
var oldDistricts = require("./old-raw.geo.json"),
newDistricts = require("./new-raw.geo.json"),
_ = require("underscore"),
turf = require("turf"),
fs = require("fs");
// Clean up GeoJSON, sort districts in order
prep(oldDistricts);
prep(newDistricts);
@Grace
Grace / README.md
Created March 15, 2016 01:40 — forked from veltman/README.md
Redistricting

Old vs. new proposed North Carolina congressional districts, data via WRAL.

Polygons were pre-processed for gentler animation as follows:

  1. For each district, find the difference n in the number of vertices between the old and new district.
  2. Add n vertices to whichever one has fewer, evenly spaced along the existing polyline, so the old and new shape each have the same number of vertices (not great for performance).
  3. For each pair of old/new district, wind the old district around to minimize the sum of the squared distances between point index i in the old district and point index i in the new district.
@Grace
Grace / gist:6b64aff648ebf7568632
Created December 16, 2015 14:42 — forked from xdite/gist:3072362
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \
@Grace
Grace / 0_reuse_code.js
Created December 16, 2015 03:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Grace
Grace / hub.html
Created December 9, 2015 13:30 — forked from phusick/hub.html
Event Hub
<html>
<head>
<title>Event Hub</title>
<script src="hub.js"></script>
<script>
var subscription = hub.subscribe('/go', function(params) {
console.log('one', params);
});
var subscription2 = hub.subscribe('/go', function(params) {
console.log('two', params);