This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'formula' | |
| class Chadwick <Formula | |
| url 'http://cdnetworks-us-2.dl.sourceforge.net/project/chadwick/chadwick-0.5/0.5.3/chadwick-0.5.3.tar.gz' | |
| homepage 'http://chadwick.sourceforge.net/doc/index.html' | |
| md5 'd8941a0bc0d075e9eb612cf7744657bf' | |
| def install | |
| system "./configure" | |
| system "make" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub vcl_recv { | |
| # ... | |
| # detect reader's device, redirect if necessary | |
| if (req.http.user-agent ~ "iPhone|iPod|Android") { | |
| if(req.http.host ~ "^example.com") { | |
| # mobile reader is on desktop site. | |
| # raise an error with status=700 and use correct url as response body. | |
| # vcl_error will use this response body as the Location: header. | |
| error 700 "http://m.example.com" + req.url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *** cwgame.c 2011-09-17 18:24:18.000000000 -0500 | |
| --- cwgame__print_ext_hdrs.c 2011-09-17 18:24:12.000000000 -0500 | |
| *************** | |
| *** 2229,2234 **** | |
| --- 2229,2246 ---- | |
| } | |
| } | |
| + for (i = 0; i <= max_ext_field; i++) { | |
| + if (ext_fields[i]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function() { | |
| var woba_fields = {nibb: (this.EVENT_CD == '14') ? 1 : 0, | |
| hbp: (this.EVENT_CD == '15') ? 1 : 0, | |
| _1b: (this.EVENT_CD == '20') ? 1 : 0, | |
| _2b: (this.EVENT_CD == '21') ? 1 : 0, | |
| _3b: (this.EVENT_CD == '22') ? 1 : 0, | |
| hr: (this.EVENT_CD == '23') ? 1 : 0, | |
| rboe: (this.BAT_SAFE_ERR_FL == 'T') ? 1 : 0, | |
| pa: 1}; | |
| emit(this.BAT_ID, woba_fields); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(key, values) { | |
| var result = {nibb: 0, hbp: 0, _1b: 0, _2b: 0, _3b: 0, hr: 0, rboe: 0, pa: 0}; | |
| for(var i in values) { | |
| result.nibb += values[i].nibb; | |
| result.hbp += values[i].hbp; | |
| result._1b += values[i]._1b; | |
| result._2b += values[i]._2b; | |
| result._3b += values[i]._3b; | |
| result.hr += values[i].hr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(key, result) { | |
| return ((0.72 * result.nibb) + (0.75 * result.hbp) + (0.9 * result._1b) + (0.92 * result.rboe) + | |
| (1.24 * result._2b) + (1.56 * result._3b) + (1.95 * result.hr)) / result.pa; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bson.code import Code | |
| import pymongo | |
| connection = pymongo.connection.Connection() | |
| db = connection['retrosheet'] | |
| tbl = db['events_2010'] | |
| # limit results to complete plate appearances. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models import signals | |
| from haystack.indexes import RealTimeSearchIndex | |
| class ManyAwareRealTimeSearchIndex(RealTimeSearchIndex): | |
| """Many-to-many aware real-time search index base class | |
| """ | |
| def _on_m2m_changed(self, instance, using=None, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import dateutil.tz | |
| import pytz | |
| def get_formatted_tz(zone): | |
| """Returns +/-HH:MM formatted time zone offset. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| last = '' | |
| punc = ',' | |
| while True: | |
| c = sys.stdin.read(1) | |
| if c: |