Skip to content

Instantly share code, notes, and snippets.

View billhorsman's full-sized avatar

Bill Horsman billhorsman

View GitHub Profile
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
apps = `heroku list 2> /dev/null`.split("\n")
apps = apps.map {|app|
case app.strip
when /^===/
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
$form.fileupload
dataType: "json"
done: (e, data) ->
result = if data.result?
# XHR (as used by, say, Chrome) gives you a simple JSON object
data.result
else
# iframe (as used by IE) gives you text back that you'll want to parse manually)
# Urgh. UTF8 value (passed by Rails form) causes JSON to fall over. Crappy solution on next line.
data = JSON.stringify(data).replace(/"name":"utf8","value":"[^"]*"/, '"name":"utf8","value":"REMOVED"')
@billhorsman
billhorsman / descriptive_sql_load_log.rb
Created July 20, 2011 14:35 — forked from JackDanger/descriptive_sql_load_log.rb
Let Rails display file names and line numbers for log activity.
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
# Turn:
# User Load (6.3ms) SELECT * FROM "users"
# Into:
# User Load /app/views/_partial.erb:27 (6.3ms) in `_app_views_partial_erb` SELECT * FROM "users"