Skip to content

Instantly share code, notes, and snippets.

Andrew McGill arm5077

Block or report user

Report or block arm5077

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arm5077
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="https://cdn.theatlantic.com/assets/media/img/posts/2019/01/Masthead_Reporting_Residency_header/508d2bd0d.png" 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%">
<tbody>
<tr>
<td>
<p></p>
View our-towns-promo.html
<div>
<figure>
<a href="https://www.theatlantic.com/our-towns/"><img alt="" src="https://cdn.theatlantic.com/assets/media/files/notes-footer.png" style="max-width: 100%"></a>
</figure>
<style type="text/css">
figure {
box-sizing: border-box;
border: 1px solid #ccc;
border-bottom: 0px;
}
@arm5077
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
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
library(foreign)
library(survey)
# Make folder to contain all the output CSVs
dir.create('output', showWarnings = FALSE)
# Download file and unzip into data frame
download.file("https://meps.ahrq.gov/mepsweb/data_files/pufs/h171ssp.zip",temp <- tempfile())
data = read.xport(unzip(temp))
@arm5077
arm5077 / code.gs
Last active May 1, 2017
Google Apps Script to update PM to-do spreadsheet when task is marked "Done."
View code.gs
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
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
library(Hmisc)
library(survey)
# 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
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
power.writeSync(0);
@arm5077
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 = d3.select("#map");
var svg = map.append("svg");
var country = svg.append("g");
// Grab width of containing element
var width = d3.select("#map").node().offsetWidth;
// Size container to correct dimensions
@arm5077
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
arm5077 / data.csv
Created Mar 24, 2016
De-industrialization-based model for Donald Trump in Ohio and Michigan
View data.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 52 columns, instead of 31. in line 1.
area_fips,state,name,clinton_raw,sanders_raw,clinton_percent,sanders_percent,bush_raw,carson_raw,christie_raw,cruz_raw,fiorina_raw,huckabee_raw,kasich_raw,rubio_raw,santorum_raw,trump_raw,bush_percentage,carson_percentage,christie_percentage,cruz_percentage,fiorina_percentage,huckabee_percentage,kasich_percentage,rubio_percentage,santorum_percentage,trump_percentage,1975_raw_manufacturing,1975_percent_manufacturing,1975_raw_total,1993_raw_manufacturing,1993_percent_manufacturing,1993_raw_total,2007_raw_manufacturing,2007_percent_manufacturing,2007_raw_total,2014_raw_manufacturing,2014_percent_manufacturing,2014_raw_total,1975_to_1993_manufacturing,1975_to_1993_total,1993_to_2007_manufacturing,1993_to_2007_total,2007_to_2014_manufacturing,2007_to_2014_total,1975_to_2014_manufacturing,1975_to_2014_total,gini,gini_adjusted,college_or_higher,poverty_level,percent_white_alone
26001,Michigan,ALCONA,463,455,48.74,47.89,13,27,5,460,4,2,340,138,4,1111,0.61,1.26,0.23,21.47,0.19,0.09,15.87,6.44,0.19,51.84,94,17.06,551,2
You can’t perform that action at this time.