Skip to content

Instantly share code, notes, and snippets.

View kylev's full-sized avatar
💭
Pushing the (mostly) right buttons.

Kyle VanderBeek kylev

💭
Pushing the (mostly) right buttons.
View GitHub Profile
timed_loop_batch(0.25, 1000, 100) do |batch_size|
changed = GiantMetric.connection.update_sql("DELETE FROM giant_metrics WHERE created_at <= #{1.month.ago} LIMIT #{batch_size}")
break if changed < batch_size
end
@kylev
kylev / dev.rake
Created September 22, 2011 22:34
Simple rake example for generating the configs a new developer will need to start up their environment.
DATABASE_YAML = <<-YML
defaults: &defaults
adapter: mysql2
username: root
password:
host: localhost
port: 3306
development:
<<: *defaults
@kylev
kylev / gist:1050398
Created June 28, 2011 03:03
Attempt to prevent errors from subdomain-fu on 2.3.8 when people request/probe using an IP-based URL
diff --git a/lib/core_extensions/action_controller_request.rb b/lib/core_extensions/action_controller_request.rb
index fcd578c..08bdd4a 100644
--- a/lib/core_extensions/action_controller_request.rb
+++ b/lib/core_extensions/action_controller_request.rb
@@ -7,4 +7,11 @@ class ActionController::Request
end
end
+
+ BASE_CHANGE_DOMAIN = ENV['BASE_URL'].split(':')[0]
02:53 <@kylev> anyone awake?
02:55 <@emopants> no
02:55 <@kylev> can you reach www.change.org?
02:56 <@emopants> no
02:56 <@emopants> 10 AMAZON.COM.edge2.Washington1.Level3.net (4.79.22.2) 95.528 ms
AMAZONCOM.edge2.Washington1.Level3.net (4.79.22.10) 96.821 ms
AMAZONCOM.edge2.Washington1.Level3.net (4.79.230.46) 96.502 ms
02:56 <@emopants> 11 * * *
02:57 <@emopants> looks like the amazon cloud is angry
02:57 <@emopants> 8 vadata-gw.ip4.tinet.net (173.241.128.46) 114.560 ms 112.409 ms