I hereby claim:
- I am gaffneyc on github.
- I am gaffneyc (https://keybase.io/gaffneyc) on keybase.
- I have a public key whose fingerprint is 16D8 FE25 1160 5118 22EC 3B48 0F56 ABBB D997 1DF8
To claim this, I am signing this object:
ActiveSupport::Notifications.subscribe("sql.active_record") do |name, start, finish, id, payload| | |
if payload[:sql] =~ /^\s*(SELECT|DELETE|INSERT|UPDATE) / | |
method = $1.downcase | |
table = nil | |
# Determine the table name for instrumentation. The below regexes work on | |
# mysql but not sqlite. Probably won't work on postgresql either. | |
case method | |
when "select", "delete" | |
table = $1 if payload[:sql] =~ / FROM `(\w+)`/ |
require "open3" | |
class TarApp | |
def call(env) | |
data = nil | |
status = nil | |
if(env["REQUEST_PATH"] !~ /(tgz|tar\.gz)/) | |
return [ 301, { "Location" => "/current.tgz" }, "" ] | |
end |
# SomeClass.new("arg1", "arg2").call | |
class SomeClass < Struct.new(:arg1, :arg2) | |
def call | |
@arg1 + @arg2 | |
end | |
end | |
# vs | |
# SomeClass.new.some_method(arg1, arg2) |
Vagrant::Config.run("2") do |config| | |
# Clean up the default image to remove some default puppet, chef, and ruby. | |
config.vm.provision :shell do |shell| | |
shell.inline = <<-EOF.gsub(/^ +/, "") | |
# Make sure vagrant always has sudo access | |
( cat << 'EOP' | |
Defaults exempt_group=vagrant | |
%vagrant ALL=NOPASSWD:ALL | |
EOP | |
) > /etc/sudoers.d/vagrant |
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.CLTools_Executables.bom | |
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.CLTools_Executables.plist | |
if [ ! -f "$RECEIPT_FILE" ] | |
then | |
echo "Command Line Tools not installed." | |
exit 1 | |
fi | |
echo "Command Line Tools installed, removing ..." |
I hereby claim:
To claim this, I am signing this object:
{ | |
{I have|I’ve} been {surfing|browsing} online | |
more than {three|3|2|4} hours today, yet I never | |
found any interesting article like yours. {It’s|It is} pretty worth enough for | |
me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web | |
owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever | |
before.| | |
I {couldn’t|could not} {resist|refrain from} commenting. | |
{Very well|Perfectly|Well|Exceptionally well} written!| | |
{I will|I’ll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} |
Rails.application.configure do | |
# Don't write output to test.log | |
config.logger = ::ActiveSupport::Logger.new("/dev/null") | |
config.logger.formatter = lambda { |*_| nil } | |
config.logger.level = 10 # FATAL is 4 | |
end |
-- We're having some really weird issues in a production application running on | |
-- Heroku PostgreSQL 9.3.5. We are seeing a number of long running queries | |
-- getting stuck inside a transaction (below). We are using PgHero to see and | |
-- kill the long running queries[1]. Trying to understand what could be | |
-- happening but we're at a loss. | |
-- Usually we'll see it idle out at the `UPDATE "sprockets"` line below which | |
-- causes further updates to that row to block. This bit of code gets run about | |
-- 1000x per minute for multiple sprockets. | |
BEGIN |
VCR.configure do |c| | |
# Match the content of urlencoded forms instead of their encoded version. | |
# This is to address issues with different ordering of the same information. | |
c.register_request_matcher :form do |actual, match| | |
content_type = actual.headers["Content-Type"] | |
# Only valid for forms | |
if content_type.include?("application/x-www-form-urlencoded") | |
actual_form = Rack::Utils.parse_nested_query(actual.body) | |
match_form = Rack::Utils.parse_nested_query(match.body) |