Skip to content

Instantly share code, notes, and snippets.

View jashkenas's full-sized avatar

Jeremy Ashkenas jashkenas

View GitHub Profile
exports[key] = value for key, value of {
run : run
document : document
parse : parse
resolveSource : resolveSource
version : version
defaults : defaults
languages : languages
}
{"id":"PublicReport","title":"Annual Report","pages":131,"description":"","source":"","created_at":"Thu, 29 Jul 2010 21:44:24 +0000","updated_at":"Sat, 21 Jul 2012 06:17:25 +0000","canonical_url":"http://www.documentcloud.org/documents/6800-memo-on-alternatives-to-comprehensive-immigration-reform.html","contributor":"Krista Kjellman Schmidt","contributor_organization":"ProPublica","resources":{"pdf":"http://localhost:8080/DA-WEB/publication_opener/PublicReport.pdf","text":"http://s3.documentcloud.org/documents/6800/memo-on-alternatives-to-comprehensive-immigration-reform.txt","thumbnail":"http://s3.documentcloud.org/documents/6800/pages/memo-on-alternatives-to-comprehensive-immigration-reform-p1-thumbnail.gif","page":{"text":"http://localhost:8080/DA-WEB/publication_opener/txt/file{page}.txt","image":"http://localhost:8080/DA-WEB/publication_opener/image/image{page}.png"}},"sections":[],"annotations":[]}
.tooltip {
position: absolute;
padding: 8px 10px;
border: 1px solid #999;
z-index: 100;
width: 100px;
background: #fff;
font: 11px/14px Arial;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
attributeValueDoubleQuoted =
QUOTE: afterAttributeValueQuoted
"&": charRefInAttributeValue
NULL: (error) ->
token.pushAttributeValue(REPLACEMENT)
EOF: (error) ->
data
default: ->
token.pushAttributeValue(char)
# In development mode, optionally perform a RubyProf profile of any request.
# Simply pass perform_profile=true in your params.
def perform_profile
return yield unless params[:perform_profile]
require 'ruby-prof'
RubyProf.start
yield
result = RubyProf.stop
printer = RubyProf::FlatPrinter.new(result)
File.open("#{Rails.root}/tmp/profile.txt", 'w+') do |f|
Processing by LiveResultsController#show as
Parameters: {"date"=>"2012-01-31"}
Rendered components/_fb_js_foot.html.erb (0.0ms)
Rendered components/_navigation.html.erb (61.8ms)
Rendered results/_web_results.html.erb (0.6ms)
Rendered live_results/show.html within /usr/local/rvm/gems/ree-1.8.7-2011.03@election_2012/gems/nytpage-0.3.3/lib/../layouts/interactive (64.0ms)
Completed 500 Internal Server Error in 78ms
** [Airbrake] Success: Net::HTTPOK
** [Airbrake] Environment Info: [Ruby: 1.8.7] [Rails: 3.0.10] [Env: production]
** [Airbrake] Response from Airbrake:
Security Alert - Please reset your npm registry account
==================================================
The security of the npm registry has just been upgraded. This corrects a known
flaw which led to the leakage of the password_sha and salt fields. The good
news is that the leak is plugged. The bad news is that it existed for quite a
while.
tl;dr
javascript:(function(){function%20f(b){b=b||window;for(var%20g=b.document.getElementsByTagName("link"),a=0,d=g.length;a<d;a++){var%20e=g[a],c=e.href;if(c&&/stylesheet/i.test(e.rel)){c=c.replace(/(&|%5C?)forceReload=\d+/,"");var%20h="forceReload="+(new%20Date).valueOf();e.href=c+(c.indexOf("?")>=0?"&":"?")+h}}a=0;for(d=b.frames.length;a<d;a++)f(b.frames[a])}f()})();
# Select only a sub-set of passed parameters. Useful for whitelisting
# attributes from the params hash before performing a mass-assignment.
def pick(hash, *keys)
filtered = {}
hash.each {|key, value| filtered[key.to_sym] = value if keys.include?(key.to_sym) }
filtered
end
app.get '/dynamic/data.js', (req, res) ->
db.selectTable 'projects', (projects) ->
db.selectTable 'memberships', (memberships) ->
db.selectTable 'pipes', (pipes) ->
db.selectFeeds (feeds) ->
# ... respond to request here ...