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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matt-bernhardt
matt-bernhardt / mitlib-content-model.php
Created January 28, 2019 19:59
Snippet to establish a WordPress custom post type in vanilla PHP
<?php
/**
* Plugin Name: MITlib Content Model
*
* @package mitlib-content-model
* @version 0.0.1
*/
/**
* Register content types
@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" />
#!/usr/bin/env python
from __future__ import print_function
import json
import sys
from datetime import timedelta, datetime
from random import randint, choice
countries = ('004','008','010','012','016','020','024','028','031','032','036','040','044','048','050','051','052','056','060','064','068','070','072','074','076','084','086','090','092','096','100','104','108','112','116','120','124','132','136','140','144','148','152','156','158','162','166','170','174','175','178','180','184','188','191','192','196','203','204','208','212','214','218','222','226','231','232','233','234','238','239','242','246','248','250','254','258','260','262','266','268','270','275','276','288','292','296','300','304','308','312','316','320','324','328','332','334','336','340','344','348','352','356','360','364','368','372','376','380','384','388','392','398','400','404','408','410','414','417','418','422','426','428','430','434','438','440','442','446','450','454','458','462','466','470','474','478','480','484','492','496','498
@matt-bernhardt
matt-bernhardt / README.md
Last active February 15, 2018 03:05
Columbus Attendance Changes In Context

This is an attempt to build a visualization of organic attendance growth by the Columbus Crew over various time periods during their 21-year history.

For more information about this plot, please reach out to me on Twitter at @BernhardtSoccer.

@matt-bernhardt
matt-bernhardt / extractor.vbs
Created March 7, 2017 22:23
A short VBscript that will extract comments from a Word document and store them as a table in Excel. Created for part of a project that involves "coding" a large number of transcripts according to certain arbitrary categories.
Option Explicit
' #############################################################
' #
' # Define Objects and Variables
' #
Dim oFSO
Dim LogFile
Dim strPath
@matt-bernhardt
matt-bernhardt / analysis.R
Last active December 7, 2016 20:02
MLS offseason turnover data, 2013 - 2015
data <- read.csv("turnover.csv")
summary(data)
str(data)
# Histograms
# Figure 1 - histogram of turnover by player
summary(data$Pctg.Players)
hist(
Team Team3 Date H/A Opponent Opp3 Score WDL Passes P.Pctg Attacking A.Pctg Third T.Pctg Crosses C.Pctg Possession
New York Red Bulls NY 3/6/2016 H Toronto FC TOR 0 L 549 0.72 384 0.65 181 0.56 20 0.45 0.63
Toronto FC TOR 3/6/2016 A New York Red Bulls NY 2 W 329 0.58 189 0.47 87 0.44 9 0.11 0.37
Orlando City ORL 3/6/2016 H Real Salt Lake RSL 2 D 373 0.8 274 0.67 146 0.66 38 0.21 0.53
Real Salt Lake RSL 3/6/2016 A Orlando City ORL 2 D 358 0.76 237 0.68 84 0.58 10 0.2 0.47
Chicago Fire CHI 3/6/2016 H New York City FC NYC 3 L 303 0.66 173 0.52 90 0.62 21 0.05 0.39
New York City FC NYC 3/6/2016 A Chicago Fire CHI 4 W 500 0.78 310 0.71 184 0.69 8 0 0.61
FC Dallas DAL 3/6/2016 H Philadelphia Union PHI 2 W 347 0.69 206 0.55 107 0.54 17 0.12 0.49
Philadelphia Union PHI 3/6/2016 A FC Dallas DAL 0 L 375 0.69 237 0.58 117 0.57 17 0.24 0.51
Houston Dynamo HOU 3/6/2016 H New England Revolution NE 3 D 382 0.75 222 0.6 112 0.61 25 0.2 0.52
@matt-bernhardt
matt-bernhardt / ppg_2011-2015.csv
Created July 10, 2016 15:27
Points Per Game after every round of MLS play, from 2011 - 2015
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 40 columns, instead of 36. in line 5.
ID,Season,Team,Playoffs,Position,TeamID,G1,G2,G3,G4,G5,G6,G7,G8,G9,G10,G11,G12,G13,G14,G15,G16,G17,G18,G19,G20,G21,G22,G23,G24,G25,G26,G27,G28,G29,G30,G31,G32,G33,G34
1,2011,Columbus,Yes,4,11,0,0.5,1.33,1.25,1.6,1.5,1.71,1.63,1.44,1.3,1.27,1.25,1.38,1.29,1.4,1.5,1.41,1.5,1.47,1.4,1.48,1.55,1.48,1.54,1.6,1.54,1.48,1.46,1.41,1.37,1.32,1.38,1.42,1.38
2,2011,DC,No,7,12,3,1.5,1,1,1.4,1.17,1,1.25,1.22,1.2,1.36,1.33,1.23,1.21,1.2,1.19,1.29,1.28,1.21,1.3,1.29,1.36,1.35,1.29,1.36,1.31,1.3,1.36,1.31,1.27,1.23,1.19,1.18,1.15
3,2011,Chicago,No,6,13,1,2,1.33,1,0.8,0.83,0.86,0.88,0.89,0.8,0.82,0.83,0.85,1,1,1,1,1,0.95,0.9,0.9,0.86,0.87,0.88,0.96,1.04,1,1.07,1.14,1.2,1.19,1.16,1.21,1.26
4,2011,Colorado,Yes,5,14,3,3,3,2.25,1.8,1.5,1.43,1.63,1.56,1.5,1.45,1.42,1.38,1.36,1.47,1.38,1.29,1.28,1.26,1.35,1.29,1.36,1.35,1.42,1.48,1.54,1.52,1.46,1.41,1.37,1.35,1.41,1.39,1.44
5,2011,New England,No,9,15,1,2,1.67,1.5,1.2,1,1.29,1.13,1.11,1.3,1.18,1.08,1,0.93,0.93,0.94,0.88,0.89,0.84,0.95,0.95,0.95,0.91,0.88,0.88,0.88,0.89,0.96,0.93,0.9
@matt-bernhardt
matt-bernhardt / winless.csv
Created August 6, 2016 03:11
Results in Columbus Crew SC history, to identify the longest winless streaks in team history.
ShortDate CrewScore OppScore Result Last Win Days Since Days Into Season
4/13/1996 4 0 Win 4/13/1996 0 0
4/20/1996 1 2 4/13/1996 7 7
4/27/1996 2 0 Win 4/27/1996 14 14
5/2/1996 4 6 4/27/1996 5 19
5/5/1996 0 0 4/27/1996 8 22
5/11/1996 3 2 Win 5/11/1996 14 28
5/15/1996 2 5 5/11/1996 4 32
5/19/1996 2 4 5/11/1996 8 36
5/26/1996 2 3 5/11/1996 15 43