Skip to content

Instantly share code, notes, and snippets.

View mitchellh's full-sized avatar
👻
Building.

Mitchell Hashimoto mitchellh

👻
Building.
View GitHub Profile
# This shows host only networking in a Multi-VM environment.
#
# The key point in this example is that the web and db sub-VMs
# are put on the same network so they can communicate with each
# other.
Vagrant::Config.run do |config|
# ...
config.vm.define :web do |web_config|
# Attach the web VM to the host only interface with a
# Validates that a given collection is properly populated.
#
# Usage:
#
# class Person
# has_many :assets
# validates :assets, :populated_collection => true
# end
#
class PopulatedCollectionValidator < ActiveModel::EachValidator
# How to properly handle circular references with factory_girl and rails
class Computer < ActiveRecord::Base
has_many :softwares
end
class Software < ActiveRecord::Base
belongs_to :computer
end
From f9dc8652969aa9372ded7651d844012b717f0bf0 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Tue, 24 Aug 2010 08:42:42 -0700
Subject: [PATCH] Typo fix in Thor::Group documentation on `desc`
---
lib/thor/group.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/thor/group.rb b/lib/thor/group.rb
From adf9b164eddbfd631d33260671013047eec7a852 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Thu, 2 Sep 2010 23:07:54 -0700
Subject: [PATCH] `rake install` properly reports error only when install fails
---
lib/bundler/gem_helper.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
From 3b9abad80034f7aeef96a4b3f247d95cb42a4dee Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Sun, 5 Sep 2010 23:39:10 -0700
Subject: [PATCH] Gemfile for easier development. Updated gemspec to be more modern.
---
.gitignore | 1 +
Gemfile | 3 +
Gemfile.lock | 21 ++++++++
Thorfile | 33 +-----------
From 167b396fea695832b07710ee318c9f903897d509 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Sun, 5 Sep 2010 23:48:07 -0700
Subject: [PATCH] Documentation fix to clarify Thor::Actions#directory
---
lib/thor/actions/directory.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/thor/actions/directory.rb b/lib/thor/actions/directory.rb
thor[master] → thor -T
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/shell.rb:26: warning: already initialized constant SHELL_DELEGATED_METHODS
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/parser/argument.rb:3: warning: already initialized constant VALID_TYPES
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/parser/arguments.rb:3: warning: already initialized constant NUMERIC
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/parser/option.rb:5: warning: already initialized constant VALID_TYPES
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/parser/options.rb:6: warning: already initialized constant LONG_RE
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vendor/thor/parser/options.rb:7: warning: already initialized constant SHORT_RE
/Users/mitchellh/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/vend
From a0794a6e9a24e3aece12bd0bb2bab0dbc139cf72 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Mon, 13 Sep 2010 13:14:38 -0600
Subject: [PATCH] Fix gemspec which had nonexistent files
---
sinatra.gemspec | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/sinatra.gemspec b/sinatra.gemspec
From b018eb0f1257f5ce2d603f975f93918c3ea73157 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Mon, 13 Sep 2010 13:32:00 -0600
Subject: [PATCH 1/2] Gemfile for development
---
.gitignore | 1 +
Gemfile | 3 +++
Gemfile.lock | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
Rakefile | 2 ++