Skip to content

Instantly share code, notes, and snippets.

View anbnyc's full-sized avatar

Alec Barrett anbnyc

View GitHub Profile
@anbnyc
anbnyc / README.md
Created April 18, 2023 23:55
Animation with d3 tutorial

This is a brief illustration of how to use animate with d3.js using two examples:

  1. A line chart that animates on load.
  2. A bar chart that is a cross-filter for the scatterplot below it, which animates in and out.

This was created for a workshop for the M.S. Data Visualization program at Parsons School of Design. Note the data was auto-generated by ChatGPT and is not intended to be real data.

@anbnyc
anbnyc / README.md
Last active September 27, 2023 07:33
Unofficial README for NYC Ranked Choice Voting Cast Vote Record (CVR)

Unofficial README for NYC Ranked Choice Voting Cast Vote Record (CVR)

The NYC BOE released the data files, but no metadata or explanation, so we have to do this ourselves.

What is in the files?

Each row is a cast vote, and each column is a preference for a candidate. These are the columns that appear in all spreadsheets, regardless of what borough or ballot type they are:

Column Explanation
Cast Vote Record unique ID number
Precinct AD (assembly district) and ED (election district) where the voter is registered(your polling place is determined by your AD/ED)
@anbnyc
anbnyc / Capital.json
Created April 22, 2021 20:27
GeoJSON of the new US capital under H.R. 51
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

image attached

@anbnyc
anbnyc / pride.glsl
Created June 14, 2019 20:52
Pride flag!
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
vec3 colorA = vec3(1., 0.01, 0.01);
vec3 colorB = vec3(0.576, 0.161, 0.976);
@anbnyc
anbnyc / StationInfo.tsv
Created April 22, 2019 19:02
Ocean plastic data files
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 22 columns, instead of 10. in line 5.
# Sampling event ID Sampling type Platform name Start day (UTC) Start month (UTC) Start year (UTC) Start UTC time (hours) End UTC time (hours) Sampling duration (hours) Start latitude (degrees) Start longitude (degrees) End latitude (degrees) End longitude (degrees) Sampling distance (km) Sampling width (km) Sampling area (km2) Sampling depth (km) Wind speed (Knots) Sea state (Beaufort) Vessel speed (knots) Observations
1 0.0 Manta trawl RV Ocean Starr 25 7 2015 22.30 22.73 0.43 33.1932 -128.7879 33.1795 -128.8071 2.36 0.0009 0.0021195 0.00015 10 3 3
2 0.1 Mega trawl RV Ocean Starr 25 7 2015 21.50 23.05 1.55 33.2135 -128.75 33.1656333333333 -128.83 9.156 0.006 0.054936 0.001 10 3 3
3 1.1 Manta trawl RV Ocean Starr 27 7 2015 15.72 18.48 2.77 29.0751 -133.9640 29.0695 -134.1250 15.66 0.0009 0.01409337 0.00015 14 4 3
4 1.2 Manta trawl RV Ocean Starr 27 7 2015 15.80 18.38 2.58 29.0748 -133.9680 29.0693 -134.1180 14.59 0.0009 0.01313172 0.00015 14 4 3
5 1.3 Mega trawl RV Ocean Starr 27 7 2015 15.57 19.22 3.65
@anbnyc
anbnyc / Amy-Klobuchar.png
Last active April 16, 2019 17:13
2020headshots
Amy-Klobuchar.png
@anbnyc
anbnyc / compare.js
Created February 25, 2019 20:28
Async JavaScript examples
function asyncWithCallbacks(callback){
getApiUrl(apiName, function(err1, url){
if(err1) throw new Error(err1);
callApi(url, function(err2, data){
if(err2) throw new Error(err2);
writeDataToServer(data, function(err3, response){
if(err3) throw new Error(err3);
console.log('welcome to the third circle of callback hell.')
callback(response);
})
@anbnyc
anbnyc / .block
Last active August 2, 2018 19:34
Senate Scenarios
license: mit
height: 500
border: no
@anbnyc
anbnyc / .block
Last active July 31, 2018 20:02
Composition
license: mit
height: 500
border: no