I hereby claim:
- I am glv on github.
- I am glv (https://keybase.io/glv) on keybase.
- I have a public key whose fingerprint is 0CF3 D473 4F46 7494 1975 290C DA1F 2F76 9F2F 5496
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| (spit (nth *command-line-args* 2) | |
| (clojure.string/join "\n" | |
| (sort (clojure.string/split-lines (slurp (nth *command-line-args* 1)))))) |
Every couple of weeks, I hear someone complaining about some difficulties with Bundler. Yesterday, it happened twice. But somehow I just never have those difficulties. I'm not saying Bundler is perfect; certainly in its early days it wasn't even close. But for the past two years it's been incredibly solid and trouble-free for me, and I think a large part of the reason is the way I use it. Bundler arguably does too much, and just as with Git, a big part of it is knowing what not to do, and configuring things to avoid the trouble spots.
| # I source this from ~/.bash_profile | |
| # I think I got them from @JEG2 | |
| BUNDLED_COMMANDS="foreman rackup rails rake rspec ruby shotgun spec watchr nesta cap" | |
| ## Functions | |
| bundler-installed() | |
| { | |
| which bundle > /dev/null 2>&1 |
| #!/bin/sh | |
| exec "$GIT_EXEC_PATH/git" "$@" |
| require 'active_record' | |
| module ActiveRecord | |
| module Associations | |
| # This fix allows the association extension methods to work when used in combination | |
| # with built-in Arel scoping methods (where, joins, etc.) and *also* with named scopes | |
| # defined on the target class. | |
| class AssociationProxy | |
| def with_scope_with_extensions(*args, &block) |
| def evolve(generation) | |
| live_neighbor_stats = generation_stats(generation) | |
| live_neighbor_stats[3] + (live_neighbor_stats[2] & generation) | |
| end | |
| def generation_stats(live_cells) | |
| live_cells.each_with_object(Hash.new(0)) {|live_cell, counter| | |
| neighbors(*live_cell).each {|neighbor| counter[neighbor] += 1 } | |
| }.each_with_object(Hash.new {|h,k| h[k] = []}) {|(cell, count), collector| collector[count] << cell} | |
| end |
| # for background, see http://m.onkey.org/use-index-with-active-record-finders | |
| # and http://twitter.com/#!/dougalcorn/status/4963159878139904 | |
| from = "#{quoted_table_name} USE INDEX(index_activities_on_created_at_and_country_id)" | |
| Activity.from(from).where('created_at >= ? AND country_id = ?', 10.days.ago, 79).all |
| # Put this in your .irbrc, and then type | |
| # "some_object.my_methods" in an IRB session | |
| # for less noisy exploration of what objects | |
| # can do. | |
| class Object | |
| def my_methods | |
| base_object = case self | |
| when Class then Class.new | |
| when Module then Module.new |
| entries.map(&:job).sort_by(&:number).map(&:project).compact.uniq |