Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@kadamwhite
kadamwhite / index.html
Last active September 16, 2015 03:47
Week Three exercise for datavis with d3 course: graph of untitled MoMA accessions by year
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Untitled Works in the MoMA Collection</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
</head>
<body>
<h2>MoMA Acquisition History for Untitled Works</h2>
<p><em>Total quantity of untitled works<sup>*</sup> acquired by the Museum of Modern Art in each calendar year between 1935 and 2015</em></p>
@kadamwhite
kadamwhite / index.html
Created September 14, 2015 21:29
Week Two exercise for DataVis and Infographics with D3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Untitled Works in the MoMA Collection</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
</head>
<body>
<svg width="540" height="520">
<style type="text/css">
@kadamwhite
kadamwhite / index.js
Created September 14, 2015 18:59
Filtered MOMA dataset: All works with "Untitled" somewhere in the name
'use strict';
var fs = require( 'fs' );
var csv = require( 'csv' );
var _ = require( 'lodash' );
var parser = csv.parse({
auto_parse: true,
skip_empty_lines: true,
columns: true, // auto-discover column headers
@kadamwhite
kadamwhite / lint-diff-package.json
Created August 31, 2015 19:35
Use `git diff` and `grep` to selectively lint changed files
{
"scripts": {
"jscs:branch": "jscs $(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base head master) | grep '.js$') || true",
"jshint:branch": "jshint $(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base head master) | grep '.js$') || true",
"jscs:diff": "jscs $(git diff --name-only --diff-filter=ACMRTUXB | grep '.js$') || true",
"jshint:diff": "jshint $(git diff --name-only --diff-filter=ACMRTUXB | grep '.js$') || true",
"jscs:prev": "jscs $(git diff head~1 --name-only --diff-filter=ACMRTUXB | grep '.js$') || true",
"jshint:prev": "jshint $(git diff head~1 --name-only --diff-filter=ACMRTUXB | grep '.js$') || true"
}
}
:cuttlefish:
:hotdog:
:shark:
@kadamwhite
kadamwhite / is-one-within-another.js
Created July 31, 2015 16:09
#angularjs channel question
function isWithin( className, node ) {
// Strip off leading period: classList api doesn't use CSS selectors
className = className.replace( /^\./, '' );
// If we're all the way up the tree and haven't found a match, stop
if ( ! node.parentNode || node.parentNode.tagName === 'BODY' ) {
return false;
}
// If we've found a match, return true
@kadamwhite
kadamwhite / fonts.md
Created May 15, 2015 17:05
nice google web fonts
Johann Sebastian Bach (31 March [O.S. 21 March] 1685 – 28 July 1750) was
a German composer and musician of the Baroque period. He enriched established
German styles through his skill in counterpoint, harmonic and motivic
organisation, and the adaptation of rhythms, forms, and textures from abroad,
particularly from Italy and France. Bach's compositions include the Brandenburg
Concertos, the Goldberg Variations, the Mass in B minor, two Passions, and over
three hundred sacred cantatas of which nearly two hundred survive. His music
is revered for its technical command, artistic beauty, and intellectual depth.
http://en.wikipedia.org/wiki/Johann_Sebastian_Bach
@kadamwhite
kadamwhite / git-diff-name-only.js
Created April 2, 2015 21:52
get changed files from Git, with Node
var diff = require('child_process').spawn('git', [
'diff',
'--name-only'
]);
diff.stdout.on('data', function (data) {
var files = data.toString().split('\n').filter(function(val) {
// Filter out ""
return val;
});

for q1, I've seen plugins that support eg

taskname: {
  options: {
    some: 'opts'
  },
  target1: {
 src: []