Skip to content

Instantly share code, notes, and snippets.

@dmarkow
dmarkow / bug_test.rb
Created August 20, 2014 19:17
ActiveRecord 4.2.0.beta1 Polymorphic includes
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'pg'
GEMFILE
@dmarkow
dmarkow / keybase.md
Created May 9, 2014 20:02
keybase.md

Keybase proof

I hereby claim:

  • I am dmarkow on github.
  • I am dmarkow (https://keybase.io/dmarkow) on keybase.
  • I have a public key whose fingerprint is E531 292A 4B9E 2597 C1EB C81A B28C 7AFC D839 FDCF

To claim this, I am signing this object:

/* Put your CSS here */
html, body {
margin: 20px;
}
@dmarkow
dmarkow / gist:6170832
Last active December 20, 2015 17:48
Levenshtein distance of company names
with foo as (select company,
length(company),
levenshtein('Company Name', company) from contacts)
select company from contacts where
company in
(select company from foo where company != contacts.company and
(
select (1 - (cast(levenshtein as real)/greatest(length(contacts.company),length)))
) > 0.8
@dmarkow
dmarkow / active_record_master.rb
Last active December 18, 2015 15:39
ActiveRecord / Postgresql binding issue
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'pg'
GEMFILE
system 'bundle'
end
@dmarkow
dmarkow / app_delegate.rb
Created August 29, 2012 03:35
Broken performSelector:withObject:afterDelay in RubyMotion 1.22
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
test_perform_selector
true
end
def test_perform_selector
foo = "bar"
foo.retain # Crashes without this
@dmarkow
dmarkow / gist:3123623
Created July 16, 2012 16:28
Formotion on RubyMotion 1.19
dylan@macbook-air (master)✗ [1] % motion -v ~/dev/pfcs-mobile
1.19
dylan@macbook-air (master)✗ [1] % rake --trace ~/dev/pfcs-mobile
rake aborted!
key not found: "lib/formotion/form.rb"
/Users/dylan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/bubble-wrap-1.1.1/lib/bubble-wrap/requirement.rb:66:in `fetch'
/Users/dylan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/bubble-wrap-1.1.1/lib/bubble-wrap/requirement.rb:66:in `file'
/Users/dylan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/formotion-0.0.3/lib/formotion.rb:6:in `block (2 levels) in <top (required)>'
/Users/dylan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/formotion-0.0.3/lib/formotion.rb:5:in `each'
/Users/dylan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/formotion-0.0.3/lib/formotion.rb:5:in `block in <top