👨👩👧👦
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
require 'shoulda' | |
class TestClient < Test::Unit::TestCase | |
context "midterms" do | |
should "exit" do | |
# the only way to pass is not to play. | |
begin | |
require 'elections' | |
rescue SystemExit | |
assert true |
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
propublica.views.sortable = propublica.View.extend({ | |
tag : 'table', | |
cssClass : 'sortable', | |
render : function(){ | |
var self = this; | |
_.defer(function(){ | |
self.el.tablesorter({ | |
widgets: [ 'zebra'] | |
}); |
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/template/public/javascripts/application.js | |
+++ b/template/public/javascripts/application.js | |
@@ -18,20 +18,29 @@ $(document).ready(function(){ | |
$(this).addClass('sorted'); | |
}); | |
} | |
- }); | |
+ }); | |
+ | |
+ // Number formatting parsing, always difficult in JavaScript |
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
// If you imagine they do this every time on a timer, then time on site isn't measured. | |
// Imagine this comes from a cookie, they could also be collecting say the | |
// first twenty links on the page, or referrers. | |
var urlHistory = ["http://www.nytimes.com/2010/11/05/us/politics/05repubs.html?_r=1&hp" | |
, "http://politicalticker.blogs.cnn.com/2010/11/04/breaking-in-washington-republican-sen-candidate-concedes/?hpt=T1" | |
, "http://www.propublica.org/blog/item/meet-the-likely-house-committee-chairs-promise-roll-back-regulation" | |
, "http://www.nytimes.com/2010/11/05/opinion/05fri1.html?_r=1&hp" | |
, "http://www.latimes.com/news/local/la-me-sex-offenders-20101105,0,6413324.story" | |
, "http://www.latimes.com/sports/la-sp-1030-world-series-rangers-20101030,0,1806241.story" |
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
require 'action_view/helpers' | |
class TableFu::Formatting | |
class << self | |
include ActionView::Helpers::NumberFormatter | |
def without_commas(coll) | |
number_to_currency(col, :delimiter => " ") | |
end | |
end | |
end |
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
<ul class="fmenu article-tools"> | |
<li class="tw-link first"></li> | |
<li class="fb-link"></li> | |
<li class="buzz-link"></li> | |
</ul> |
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
propublica.views.chiclets = propublica.Deferrable.extend({ | |
cssClass : 'social-module', | |
render : function(){ | |
this.url = window.PP_SHARING_URL || window.location.protocol + "//" + window.location.host + window.location.pathname; | |
this.short_url = window.PP_BITLY || this.url; | |
this.client = new propublica.models.RESTClient(); | |
this.client.url = "http://search.twitter.com/search.json?callback=?"; |
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
<%- array = [1,2,3,4,5,6,7] %> | |
<%- grouped = array.in_groups(3) %> | |
<table> | |
<% grouped.first.each_with_index do |first_col, index| %> | |
<tr> | |
<td><%= first_col %></td> | |
<td><%= grouped[1][index] %></td> | |
<td><%= grouped[2][index] %></td> | |
</tr> | |
<% end %> |
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
module Graticule #:nodoc: | |
module Geocoder #:nodoc: | |
class Google | |
def initialize(key) | |
@key = key | |
@proxies = ["http://127.0.0.1:8080", "http://127.0.0.1:8081", "http://127.0.0.1:8082"] | |
@url = URI.parse @proxies[rand(@proxies.length)] + '/maps/geo' | |
end | |
end | |
end |
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
* File "anna.dat" from the Stanford GraphBase (C) 1993 Stanford University | |
* Anna Karenina, by Leo Nikolaevitch Tolstoy | |
* This file may be freely copied but please do not change it in any way! | |
* (Checksum parameters 378,911441608) | |
AA Annushka, maid of AN | |
AG Agafea Mihalovna, housekeeper of LE | |
AL Alexey Alexandrovitch Karenin, minister of state | |
AN Anna Arkadyevna Karenina, wife of AL | |
AO Aliosha, son of DO and ST | |
AP Anna Pavlovna, wife of PV |