I hereby claim:
- I am rbgrouleff on github.
- I am nerdd (https://keybase.io/nerdd) on keybase.
- I have a public key whose fingerprint is F538 1ED7 CFB2 CBDC 7457 E09D 0669 F626 B634 BF61
To claim this, I am signing this object:
require "pathname" | |
require "strscan" | |
require "yaml/store" | |
schema = Pathname.new("./db/schema.rb") | |
fks = Hash.new { |hash, key| hash[key] = [] } | |
create_table = /create_table / | |
table_name = /"(\w+)"/ |
class A < ActiveRecord::Base | |
belongs_to :b | |
end | |
class B < ActiveRecord::Base | |
has_many :as | |
end | |
b = B.create | |
B.transaction do |
-- Inspired by http://veritrope.com/code/export-all-chrome-tabs-to-a-text-file/ | |
set WindowList to {} | |
tell application "Google Chrome" | |
activate | |
repeat with w in windows | |
set ActiveTabId to (id of (active tab of w)) | |
set UrlList to {} | |
set ActiveTabIdx to 1 |
I hereby claim:
To claim this, I am signing this object:
module Allocations | |
def delta_of(*classes, &block) | |
counts = Hash[classes.map { |cls| | |
[cls.name.intern, { before: ObjectSpace.each_object(cls).count }] | |
}] | |
yield | |
classes.each do |cls| | |
counts[cls.name.intern][:after] = ObjectSpace.each_object(cls).count | |
end | |
counts |
if defined? ActiveRecord | |
Pry.commands.command "explain" do |query| | |
query = target.eval "#{query}.to_sql" | |
ActiveRecord::Base.connection | |
.execute("EXPLAIN EXTENDED #{query}") | |
.to_a | |
.each { |arr| puts arr.inspect } | |
end | |
end |
class Observable | |
constructor: -> | |
@observers = {} | |
bind: (event, callback) -> | |
@observers[event] ?= [] | |
@observers[event].push callback | |
trigger: (event, data) => | |
for callback in @observers[event] |
[color] | |
branch = auto | |
diff = auto | |
interactive = auto | |
status = auto |