Skip to content

Instantly share code, notes, and snippets.

inbox_blobs() {
git ls-tree -r master | grep 'INBOX' | awk '{print $3}' | sort
}
diff <(cd ../Gmail && inbox_blobs) <(inbox_blobs) | grep '<\|>' | while read marker hash; do
echo "$marker $(git show $hash | grep -m 1 '^Subject:')"
done | sort

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

require 'benchmark'
class FooProxy
attr_reader :foo
def initialize(foo)
@foo = foo
end
def bar
@bf4
bf4 / gist:8100559
Created December 23, 2013 16:57 — forked from dhh/gist:7226428
Attention Talented Ruby on Rails Coders,
My new client is an exciting startup in the SF Bay area which has just closed on VC
funding and is actively seeking to hire several senior-level RoR coders with 3+ years of experience. They are a web and mobile platform solution allowing artists (singers, film-makers, etc.) to sell digital content directly to the consumer. They have already established multiple celebrities as members and are rapidly acquiring more. The position offers competitive salary, benefits, and pre-IPO stock options.
We are not looking for any contractors, telecommuters, or people who wish to work from remote locations. This situation may change after the company becomes more mature, but there is a strong consensus that on-site, full-time employees are required at this early stage.
We have actually already filled the CTO and CIO positions with the company in record time, largely because qualified candidates were immediately aware of the unique market-position of this company and the dynam
@bf4
bf4 / gist:8115952
Created December 24, 2013 17:27 — forked from defunkt/gist:6443
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@bf4
bf4 / 42-things.md
Created December 25, 2013 04:12 — forked from xdite/42-things.md
@bf4
bf4 / 42-things-2.md
Created December 25, 2013 22:13 — forked from xdite/42-things-2.md

11. Add Associations to a Migration

$ rails g resouce article user:references subject body:text
class CreateArticles < ActiveRecord::Migration
  def change
    create _table :articles do |t|
@bf4
bf4 / 42-things-3.md
Created December 25, 2013 22:13 — forked from xdite/42-things-3.md

21. Different a Database for Each User

def connect_to_user_database(name)
  config = ActiveRecord::Base.configurations["development"].merge("database" => "db/#{name}.sqlite3")
  ActiveRecord::Base.establish_connection(config)
end