Skip to content

Instantly share code, notes, and snippets.

View mattdennewitz's full-sized avatar

Matt Dennewitz mattdennewitz

  • Lancaster, OH
View GitHub Profile
@athiwatc
athiwatc / LevenshteinDistance.go
Created July 7, 2011 12:05
LevenshteinDistance
package LevenshteinDistance
import "fmt"
import "math"
func compare(a, b string) int {
var cost int
d := make([][]int, len(a)+1)
for i := 0; i < len(d); i++ {
d[i] = make([]int, len(b)+1)
@JeffSackmann
JeffSackmann / generateBattingMarcels.py
Created January 14, 2011 18:32
Generate a full season's worth of batting Marcel projections from past years' stats
## Generate a full season's worth of batting Marcel projections from past years' stats
from createTuple import createTuple ## gist: 778481
from writeMatrixCSV import writeMatrixCSV ## gist: 778484
def makeBatTable(r):
for stat in ['AB', 'H', 'D', 'T', 'HR', 'SO', 'BB', 'SF', 'HP', 'CI']:
if stat in r: pass
else: r[stat] = 0
if r['AB'] == 0:
@dcramer
dcramer / track_data.py
Created December 6, 2010 19:15
Tracking changes on properties in Django
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @track_data('name')