Skip to content

Instantly share code, notes, and snippets.

View jsvine's full-sized avatar

Jeremy Singer-Vine jsvine

View GitHub Profile
@jsvine
jsvine / webscript-security-breach-email.md
Created November 7, 2012 18:16
"Potential Webscript security breach" email

from: Webscript Support support@webscript.io

date: Wed, Nov 7, 2012 at 12:54 PM

Subject: Potential Webscript security breach

Planet Rational's Amazon Web Services credentials have been inadvertently exposed, potentially leaking Webscript user data. (Planet Rational is the company behind Webscript.) While we don't know that any data was accessed, we do know that it was possible.

What we recommend

@jsvine
jsvine / exif.sh
Last active December 21, 2015 09:49
A ~/.bashrc one-liner I use almost daily. Provided the URL of an image, fetches the image's EXIF data.
exif () { curl -s "$1" | exiftool - ; }
###
#
# Add the line above to your ~/.bashrc file.
#
# Requires Phil Harvey's ExifTool: http://www.sno.phy.queensu.ca/~phil/exiftool/
#
# Usage example, for Aug. 20th's en.wikipedia.org featured picture:
#
@jsvine
jsvine / rolling-average.js
Last active December 27, 2015 05:09
Just a little helper function. Depends on, and hooks into, underscore.
(function () {
var root = this;
var sum = function (arr) {
return _.reduce(arr, function (m, x) {
return m + x;
});
};
// n: Size of the stack, i.e., how far to look back
@jsvine
jsvine / exemplify.js
Created November 13, 2013 22:33
A bare-bones helper for creating simple demos/tutorials. See example usage here: http://www.jsvine.com/gmap-button/demo/
var exemplify = function (fn, code_el) {
fn.call(fn);
var str = fn.toString();
var lines = str.split("\n").slice(1, -1);
var start_index = lines[0].match(/[^\s].*$/).index;
var trimmed = lines.map(function (x) {
return x.slice(start_index);
}).join("\n");
code_el.innerHTML = trimmed;
};

An Open-Source Thank You

In late October, the WSJ published Waste Lands, an interactive database I helped build and report. Waste Lands draws upon thousands of public records and other sources to trace the history of hundreds of factories and laboratories the government recruited to help develop nuclear weapons during the build-up to the Cold War.

Building the database took considerable time and effort. But it would have been immeasurably more difficult and time-consuming — if not nearly impossible — without the fistfuls of open-source code we were able to rely upon:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsvine
jsvine / optm-report-to-tsv.js
Created February 10, 2016 12:43
Script to convert Organ Procurement and Transplantation Network website data reports into spreadsheet-friendly tab-separated values (TSV) files.
/* OPTM Report -> TSV
The script below takes reports generated by the Organ Procurement and Transplantation
Network website and converts them into spreadsheet-friendly tab-separated values (TSV) files.
Instructions:
1. Create an advanced data report at https://optn.transplant.hrsa.gov/converge/LatestData/advancedData.asp. In Step 4, keep the default options ("Counts" + "Portrait").
2. On the results page, open up your browser's console.
@jsvine
jsvine / download-craftcans.js
Created May 21, 2017 18:33
Downloading CraftCans.com's canned beer database as structured data
// Step 1: Go to http://craftcans.com/db.php?search=all&sort=beerid&ord=desc&view=text
// Step 2: Open your browser's developer console
// Step 3: Paste the code below into the console
(function () {
var getText = function (el) {
return el.textContent.trim().replace(/\n/g, " ");
};
// Get the last <table> on the page
@jsvine
jsvine / draft.md
Created June 9, 2012 18:16
Versioned Writing

Versioned Writing — an experiment

Status: Very drafty.

Git for prose, Git for everything

Recently, I've become hooked on the idea of applying version-control software (and the concepts it enables) to writing. Git and GitHub have completely transformed, for the better, the way I write and think about software. I have a hunch they can something similar for writing.

Some form of versioning already exists, raggedly, in most prose-writing workflows. It's typically linear. For instance, we all have a folder somewhere that looks like this:

@jsvine
jsvine / git-editing-offer.md
Created April 19, 2012 02:08
A Git-for-Prose Experiment

A Git-for-Prose Experiment

TL;DR: I'll edit (almost) whatever prose you throw at me, provided you agree to use git for the entire process.

If you're reading this, you're probably familiar with git. But if you're not: [git][git-wiki] is an amazingly nimble "distributed revision control" system. Or -- in plain English -- it's what might happen if track-changes, a time machine, and a collage artist had a beautiful baby.

Software development is git's nearly universal use-case, and with good reason. Its branching and merging features let developers easily collaborate and experiment with new, crazy features without having to worry about wrecking a project or taking it in the wrong direction.

But there is, I think, a huge and largely untapped potential in using git for prose. The same branching and merging features could encourage writers and editors to take risks with a piece's style or structure that might otherwise seem too daunting. At the very least, git provides a way to track changes to a docume