Skip to content

Instantly share code, notes, and snippets.

View matt-bernhardt's full-sized avatar
💭
Learning Rails...

Matthew Bernhardt matt-bernhardt

💭
Learning Rails...
View GitHub Profile
@matt-bernhardt
matt-bernhardt / wordpress-giving-widgets.wie
Created May 4, 2016 20:27
An exported widgets definition file produced by the Widget Importer & Exporter plugin.
{
"sidebar": {
"search-2": {
"title": ""
},
"recent-posts-2": {
"title": "",
"number": 5
},
"recent-comments-2": {
@matt-bernhardt
matt-bernhardt / powerpoint.html
Last active October 18, 2018 13:17
A sketch of the HTML output from PowerPoint, with changes to introduce event tracking from Google Analytics
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1'/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@matt-bernhardt
matt-bernhardt / games.csv
Created April 24, 2016 20:12
Columbus Crew away games in MLS play (league and playoffs) under Gregg Berhalter
MatchDate Competition Opponent Crew OppScore Result Venue Surface Surface Type
3/8/2014 19:00 MLS League D.C. United 3 0 Win RFK Stadium Natural Grass Natural
3/29/2014 22:00 MLS League Seattle Sounders 2 1 Win CenturyLink Field FieldTurf Artificial
4/13/2014 15:00 MLS League San Jose Earthquakes 1 1 Draw Buck Shaw Stadium Natural Grass Natural
5/4/2014 16:00 MLS League Sporting Kansas City 0 2 Loss Sporting Park Natural Grass Natural
5/7/2014 20:00 MLS League Houston Dynamo 0 1 Loss BBVA Compass Stadium Natural Grass Natural
5/17/2014 22:30 MLS League Portland Timbers 3 3 Draw Providence Park FieldTurf Artificial
5/31/2014 17:00 MLS League Toronto FC 2 3 Loss BMO Field Natural Grass Natural
6/7/2014 18:30 MLS League D.C. United 0 0 Draw FedEx Field Natural Grass Natural
7/4/2014 21:30 MLS League Colorado Rapids 1 1 Draw Dick's Sporting Goods Park Natural Grass Natural
@matt-bernhardt
matt-bernhardt / composer.json
Last active March 21, 2016 17:56
Experiments with building out a Wordpress network via Composer
{
"name": "mjbernha/composer-wp",
"description": "Composer-deployed Wordpress",
"license": "GPL-2.0",
"authors": [
{
"name": "Matt Bernhardt",
"email": "mjbernha@mit.edu"
}
],
@matt-bernhardt
matt-bernhardt / analysis.R
Last active March 5, 2016 17:00
Data and analysis scripts for an article on repeatability of success in Major League Soccer. The published article describing this work has been published at http://www.massivereportdata.com/blog/2016/03/05/revisiting-the-repeatability-of-team-success/
## Data preparation
# Read in data
data <- read.csv('data.csv')
# Convert Playoffs1 and Playoffs2 to ordered factor
data$Playoffs1 <- factor(data$Playoffs1, levels = c("Did Not Qualify", "Octofinals", "Quarterfinalist", "Semifinalist", "Finalist", "Champion"))
data$Playoffs2 <- factor(data$Playoffs2, levels = c("Did Not Qualify", "Octofinals", "Quarterfinalist", "Semifinalist", "Finalist", "Champion"))
# Add duplicate Year encoding as a factor
@matt-bernhardt
matt-bernhardt / empty-database.sh
Last active March 2, 2016 16:09
A bash script to delete all tables from a MySQL database. Useful when your user connection has rights only at the table level, so dropping and recreating the database itself isn't an option.
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
MHOST="$4"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@matt-bernhardt
matt-bernhardt / 2016.csv
Last active January 8, 2016 04:45
2016 MLS League Schedule
Game Time Home Away Venue
Sunday, March 6, 2016 1:30PM EST New York Red Bulls Toronto FC Red Bull Arena
Sunday, March 6, 2016 2:00PM EST Orlando City Real Salt Lake Orlando Citrus Bowl
Sunday, March 6, 2016 2:00PM EST Chicago Fire New York City FC Toyota Park
Sunday, March 6, 2016 3:00PM EST FC Dallas Philadelphia Union Toyota Stadium
Sunday, March 6, 2016 3:00PM EST Houston Dynamo New England Revolution BBVA Compass Stadium
Sunday, March 6, 2016 3:00PM EST San Jose Earthquakes Colorado Rapids Avaya Stadium
Sunday, March 6, 2016 4:30PM EST Portland Timbers Columbus Crew SC Providence Park
Sunday, March 6, 2016 5:30PM EST Vancouver Whitecaps FC Montreal Impact BC Place
Sunday, March 6, 2016 7:00PM EST Seattle Sounders FC Sporting Kansas City CenturyLink Field
@matt-bernhardt
matt-bernhardt / README.md
Last active December 30, 2015 17:14
Dynamic Network Visualization
@matt-bernhardt
matt-bernhardt / mls_cup_passing.R
Created December 3, 2015 05:12
Data around an analysis of the teams in the 2015 MLS Cup
# Read in data
passing <- read.csv('passing.csv')
# Subset
Portland <- subset(passing, Team == 'Portland')
Portland$Player <- factor(Portland$Player)
Portland.Starters <- subset(Portland, Starter == 'Starter')
Portland.Starters$Player <- factor(Portland.Starters$Player)
@matt-bernhardt
matt-bernhardt / convert.py
Last active December 1, 2015 20:09
This takes a string of format "(x,y") and rebuilds to a list of "x", "y"
# initial setup
foo = "(x,y)"
newFoo = foo.replace('(', '').replace(')', '').split(',')
print(str(newFoo))