👨👩👧👦
This file contains 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
""" Idea taken from here: http://github.com/ericflo/django-tokyo-sessions/tree/master | |
Basically this is a thin wrapper around django's cache fremwork to allow for persistent | |
keys with no expiration values. | |
I'm using it to store unique values that get updated infrequently, ie via cron, and which | |
don't need to expire, just be updatable. | |
Requires TT_PERSISTENT_STORE to be set in settings.py using the memcached format. | |
""" |
This file contains 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(script){ | |
var tokens = function(string){ | |
var curr_pos = string, | |
from = 0, // character position of the start of the new token in the string | |
i = 0, // current position | |
length = string.length, // total length of the string | |
tks = [], // collection of tokens | |
line = 1, // line number we're currently on | |
tokenizer = function(regex, fn){ |
This file contains 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
#diff parsing to side by side differences | |
class Differ | |
attr_reader :rows | |
LINE_REGEX = /^((?:---|[><\\]))/ | |
CONTROL_REGEX = /(\d+(?:,\d+)?)([acd])(\d+(?:,\d+)?)/ | |
def initialize(left_file, right_file) | |
@rows = [] |
This file contains 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 Graph; | |
window.Graph = Graph = function(el, data, template, highlight){ | |
this.el = $(el); | |
this.width = this.el.width(); | |
this.height = this.el.height(); | |
this.borderWidth = 5; | |
this.data = data; | |
this.matrix = new Graph.Matrix(); |
This file contains 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
#State,attribute | |
#California,sunshine | |
#California,beaches | |
#Texas,oil | |
#Texas,rock_festivals | |
s = TableFu.new(csv) | |
s.faceted_by("State").each do |state| | |
puts state.row |
This file contains 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
dispatch : function(e){ | |
e.preventDefault(); | |
var clickedOn = $(e.target); | |
clickedOn.parents(this.scope).find(this.tag).removeClass('active'); | |
clickedOn.addClass('active'); | |
this.el.filter('.active').each(function(){ | |
var disp = JSON.parse($(this).attr('data-dispatch')); | |
var key = _.keys(disp)[0]; | |
$('div#filterable').trigger(key, [disp, key]); | |
}); |
This file contains 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
// A Set implementation. If you create a set with a particular length it | |
// will be capped at that length. The array is kept in order of addition. | |
propublica.models.Set = propublica.Model.extend({ | |
init : function(vals, cap){ | |
this._super(); | |
this._attrs.values = []; | |
this._attrs.values = vals; | |
this._commit(); |
This file contains 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
// Highly experimental async google ads. | |
propublica.views.googleAds = propublica.Deferrable.extend({ | |
cssClass: "ad", | |
init : function(){ | |
this._super(); | |
}, | |
render : function(){ | |
// Add google attributes | |
var accepted = "author,scope,project,type".split(","); |
This file contains 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
javascripts | |
|____app | |
| |____app.js | |
| |____models | |
| | |____article_content.js | |
| | |____ee_cookie.js | |
| | |____page_cookie.js | |
| | |____tracking_cookie.js | |
| |____views | |
| | |____beacons |
OlderNewer