Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.
Lorem ipsum.
@app.route('/')
// Returns the class name of `object` (e.g. '[object Function]' -> 'Function') or 'NaN'. | |
// If `query` is provided, returns whether object is of type 'query'. | |
function toType(object, query) { | |
var type = object !== object ? 'NaN' : ({}).toString.call(object).match(/\s([^\]]+)/)[1]; | |
return typeof query === 'undefined' ? type : type === query; | |
} | |
toType([1, 2]); // 'Array' | |
toType([1, 2], 'Array'); // true |
def regress(x, y): | |
# Ensure equal length iterables | |
if not len(x) == len(y): | |
raise ValueError('Unequal lengths') | |
# Initialize values | |
n = len(x) | |
sx = sum(x) | |
sy = sum(y) | |
sxx = sum(val**2 for val in x) | |
sxy = sum(x_val*y_val for x_val, y_val in zip(x, y)) |
"Evaluating Pitcher Talent" (http://www.ussmariner.com/2006/08/29/evaluating-pitcher-talent/) -Dave Cameron | |
"What's a Batted Ball Worth?" (http://www.ussmariner.com/2005/11/28/run-values/) -Dave Studenmund | |
RUN VALUES | |
LD 0.356 | |
HBP 0.342 | |
uBB 0.315 |
http://www.fangraphs.com/blogs/basic-pitching-metric-correlation-1955-2012-2002-2012/ | |
http://www.fangraphs.com/blogs/basic-hitting-metric-correlation-1955-2012-2002-2012/ | |
http://www.beyondtheboxscore.com/2012/1/9/2690405/what-starting-pitcher-metrics-correlate-year-to-year | |
http://www.beyondtheboxscore.com/2011/9/1/2393318/what-hitting-metrics-are-consistent-year-to-year |
// This script fetches NFL Game Center data for each game in a given week of | |
// the NFL pre, regular, or postseason. Data for each game is loaded in the | |
// browser as a JavaScript object, which is then stringified and written to a | |
// file named after the game's Game Center ID (e.g. "2014092800.json"). | |
// | |
// Usage: | |
// | |
// casperjs gcdata.casper.js <year> <season type> <week> | |
// | |
// Example: |
CREATE | |
TABLE t_play_pos_dst | |
( | |
_gc_cur_drive_play_id INT PRIMARY KEY, | |
pos_abbr TEXT, | |
dst_abbr TEXT, | |
FOREIGN KEY (_gc_cur_drive_play_id) REFERENCES gc_cur_drive_play (_id) | |
) | |
; |
import simplejson as json | |
import gzip | |
import csv | |
import re | |
from collections import OrderedDict | |
from utils import lazy_property, Rewinder, \ | |
_retrieve_file_path, _gcdata_file_path, _all_eids, \ | |
_read_schedule, _seconds_passed, _unicode_nonempty, \ | |
_yards_fog, _to_inches, _experience, _to_date, _to_datetime, \ | |
_attrs_match, _keys_match |
# Write to file (outputs signed 16-bit integers representing audio signal) | |
rtl_fm -f 90.5M -M fm -s 50k -r 32k example.raw | |
# See the character representations of these integers (if we hadn't specified a file name, it would have printed this to terminal) | |
more example.raw | |
# Install Sound eXchange to get a program called "play" which can play the data | |
brew install sox | |
# Play the file we just recorded (32k sample rate, type = signed 16-bit, little-endian, one channel) |