Skip to content

Instantly share code, notes, and snippets.


Andrew McGill arm5077

View GitHub Profile
arm5077 / county-centroids.json
Created Nov 5, 2020
A CSV of centroids for every county in the US plus PR. Source:
View county-centroids.json
AS,Swains Island,"60040",-171.04590000000,-11.08430000000
arm5077 / index.js
Created Jul 5, 2016
A Slack doorbell run through Amazon's Lambda service and activated by its IoT button.
View index.js
exports.handler = function(event, context){
var request = require('request');
var quotes = [
quote: "Good manners will open doors that the best education cannot.",
author: "Clarence Thomas"
quote: "I think there are influences that you open the door to, and influences that come under the door.",
author: "Harrison Birtwistle"
arm5077 / masthead-reporting-residency.html
Created Sep 3, 2019
Archived Masthead Reporting Residency page
View masthead-reporting-residency.html
<figure class="u-block-center"><img alt="Masthead Reporting Residency Header Image" height="220" src="" width="331" /></figure>
<h2 style="text-align: center;"><strong>Pitch The Atlantic on a Three-Month Reporting Project</strong></h2>
<table align="center" style="width:100%">
View our-towns-promo.html
<a href=""><img alt="" src="" style="max-width: 100%"></a>
<style type="text/css">
figure {
box-sizing: border-box;
border: 1px solid #ccc;
border-bottom: 0px;
arm5077 / movies.csv
Created Oct 17, 2018
Top 20 movies of all time, by adjusted box office return
View movies.csv
Title Studio Adjusted Gross Unadjusted Gross Year
101 Dalmatians Dis. $913,243,700 adjusted $144,880,014 1961
Avatar Fox $889,409,500 adjusted $760,507,625 2009
Ben-Hur MGM $895,720,000 adjusted $74,000,000 1959
Doctor Zhivago MGM $1,134,598,100 adjusted $111,721,910 1965
E.T.: The Extra-Terrestrial Uni. $1,296,548,600 adjusted $435,110,554 1982
Gone with the Wind MGM $1,846,687,900 adjusted $198,676,459 1939
Jaws Uni. $1,170,640,400 adjusted $260,000,000 1975
Jurassic Park Uni. $837,423,500 adjusted $402,453,882 1993
Return of the Jedi Fox $859,703,000 adjusted $309,306,177 1983
arm5077 / app.js
Created Aug 31, 2016
Template for resizable D3 v4 map
View app.js
d3.json("topojson/states.topojson", function(states){
// Make SVG container
var map ="#map");
var svg = map.append("svg");
var country = svg.append("g");
// Grab width of containing element
var width ="#map").node().offsetWidth;
// Size container to correct dimensions
arm5077 / generate_insights.r
Last active May 17, 2017
Pulls insights for The Atlantics "Five Percent" project from Medical Expenditure Panel Survey data
View generate_insights.r
# Make folder to contain all the output CSVs
dir.create('output', showWarnings = FALSE)
# Download file and unzip into data frame
download.file("",temp <- tempfile())
data = read.xport(unzip(temp))
arm5077 /
Last active May 1, 2017
Google Apps Script to update PM to-do spreadsheet when task is marked "Done."
function onEdit(e) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = e.source.getActiveSheet();
var cell = e.source.getActiveRange();
if( sheet.getName() == 'Tasks' && cell.getColumn() == 4 && cell.getValue() == 'Done'){
var row = cell.getRow();
var targetSheet = spreadsheet.getSheetByName("Tasks - done");
var targetRow = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
arm5077 / analyze.r
Last active Apr 24, 2017
Pulls the top five percent of U.S. medical spenders and calculates proportions of race.
View analyze.r
# Import data from SAS transport file
data <- sasxport.get('data/h171.ssp')
# Build survey object using person weights
full_population_survey <- svydesign(ids=~1, data=data, weights=~perwt14f)
# Find cutoff for top 5 percent of spenders
arm5077 / index.js
Created Nov 22, 2016
A script for the Raspberry Pi that turns on a Powerswitch when the user says "Lumos!"
View index.js
const record = require('node-record-lpcm16');
const {Detector, Models} = require('./node_modules/snowboy/');
const Gpio = require('onoff').Gpio;
// Set up control of the pin that toggles the Powerswitch
power = new Gpio(14, 'out');
var on = false;
// Turn the power off by default