Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Learning Rails...

Matthew Bernhardt matt-bernhardt

💭
Learning Rails...
View GitHub Profile
View forms.min.css
.wpcf7 fieldset{margin-top:1.5rem;margin-bottom:1.5rem;border:1px solid #ccc;padding:1rem 1.5rem;width:75%}.wpcf7 .wpcf7-text,.wpcf7 .wpcf7-email,.wpcf7 .wpcf7-textarea{background-color:#fff;color:#000;font-size:14px}.wpcf7 .wpcf7-submit{-webkit-appearance:none;transition:background-color 0.25s, border 0.25s;border:1px solid #338bc5;border-radius:3px;padding:5px 10px;background-color:#338bc5;background-image:none;font-size:1rem;color:#fff;margin-top:10px}.wpcf7 legend{padding:0 1rem;font-size:0.9rem;color:#595959;text-transform:uppercase;width:auto}.wpcf7 .button-primary.green,.wpcf7 .wrap-outer-header-local .green.action-auth{border:1px solid #3b815d;background-color:#43926a;margin:0;max-width:15rem}.wpcf7 .button-primary.green:focus,.wpcf7 .wrap-outer-header-local .green.action-auth:focus,.wpcf7 .button-primary.green:hover,.wpcf7 .wrap-outer-header-local .green.action-auth:hover{background-color:#2ea76a;border-color:#43926a}.wpcf7 .wpcf7-list-item{display:block}.loading-container{display:block;width:100%;he
@matt-bernhardt
matt-bernhardt / year-over-year-ppg.csv
Created Feb 29, 2020
A dataset of MLS team performance (measured by Points Per Game) from year to year between 1996 and 2019. Brief context at https://twitter.com/bernhardtsoccer/status/1233859569983639552
View year-over-year-ppg.csv
ID Team Year1 Pts1 GP1 PPG1 Playoffs1 Playoffs1Int Year2 Pts2 GP2 PPG2 Playoffs2 Playoffs2Int
1 Colorado Rapids 1996 29 32 0.9063 Did Not Qualify 0 1997 38 32 1.1875 Finalist 4
2 Columbus Crew 1996 37 32 1.1563 Quarterfinalist 2 1997 39 32 1.2188 Semifinalist 3
3 D.C. United 1996 46 32 1.4375 Champion 5 1997 55 32 1.7188 Champion 5
4 FC Dallas 1996 41 32 1.2813 Quarterfinalist 2 1997 42 32 1.3125 Semifinalist 3
5 Los Angeles Galaxy 1996 49 32 1.5313 Finalist 4 1997 44 32 1.375 Quarterfinalist 2
6 New England Revolution 1996 33 32 1.0313 Did Not Qualify 0 1997 37 32 1.1563 Quarterfinalist 2
7 New York Red Bulls 1996 39 32 1.2188 Quarterfinalist 2 1997 35 32 1.0938 Did Not Qualify 0
8 San Jose Earthquakes 1996 39 32 1.2188 Quarterfinalist 2 1997 30 32 0.9375 Did Not Qualify 0
9 Sporting Kansas City 1996 41 32 1.2813 Semifinalist 3 1997 49 32 1.5313 Quarterfinalist 2
@matt-bernhardt
matt-bernhardt / 4lda-notes-only.py
Last active Dec 18, 2019
2019 Learning Days - attempting a rudimentary Recommender System with ASpace data
View 4lda-notes-only.py
from __future__ import absolute_import
import csv
from time import time
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction import text
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
# This attempts to perform LDA on the text of the notes from ArchivesSpace.
View README.md
View attendance.ipynb
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 Jan 28, 2019
Snippet to establish a WordPress custom post type in vanilla PHP
View mitlib-content-model.php
<?php
/**
* Plugin Name: MITlib Content Model
*
* @package mitlib-content-model
* @version 0.0.1
*/
/**
* Register content types
@matt-bernhardt
matt-bernhardt / README.md
Last active Feb 15, 2018
Columbus Attendance Changes In Context
View README.md

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 / model170501.py
Created Oct 15, 2017
A simple python script that runs a monte carlo simulation of the remaining games in a Major League Soccer season. This is pretty coupled to the database I use, and some shim objects I wrote for that database - but the approach should be clear though.
View model170501.py
import copy
import database
from log import Log
from output import Output
import numpy as np
def calculatePPG(data):
# This expects data in a form of
# {'MIN': {'Points': 8.0, 'PPG': 0.8888888888888888, 'GP': 9.0}, 'TOR': {'Points': 16.0, 'PPG': 1.7777777777777777, 'GP': 9.0}}
@matt-bernhardt
matt-bernhardt / extractor.vbs
Created Mar 7, 2017
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.
View extractor.vbs
Option Explicit
' #############################################################
' #
' # Define Objects and Variables
' #
Dim oFSO
Dim LogFile
Dim strPath
@matt-bernhardt
matt-bernhardt / analysis.R
Last active Dec 7, 2016
MLS offseason turnover data, 2013 - 2015
View analysis.R
data <- read.csv("turnover.csv")
summary(data)
str(data)
# Histograms
# Figure 1 - histogram of turnover by player
summary(data$Pctg.Players)
hist(
You can’t perform that action at this time.