Moved to https://github.com/dkubb/git-tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# current code: | |
unless @users = cache_get("active_users") | |
@users = User.all(:active => true) | |
cache_set("active_users", @users) | |
# object caching can be used to avoid pulling huge amounts of data | |
# from the database. | |
# you could have calle cache_set with an expiration time as well: | |
# cache_set("active_users", @users, 10) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Upgrade, Update, Check Homebrew | |
update | |
upgrade | |
doctor | |
# Install taps | |
tap caskroom/cask | |
tap sceaga/tap | |
# Install bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'mechanize' | |
require 'addressable/uri' | |
ROOT_URL = Addressable::URI.parse(ARGV.fetch(0)).freeze | |
# Disable SSL certificate verification | |
I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inside Rakefile | |
unless ARGV.any? && ARGV[0][0..3] == 'dm:' | |
Kernel.send(:undef_method, :repository) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it 'should save both the object and parent if both are new' do | |
pending('This is a bug that should be fixed') do | |
area1 = Area.new(:name => 'area1') | |
area1.machine = Machine.new(:name => 'machine1') | |
area1.save | |
area1.machine_id.should == area1.machine.id | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
father = Father.new | |
child = Child.new(:father => father) | |
father.save | |
child.father_id.should == father.id # how? the child references the father, but there's no backlink atm | |
# ... unless | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@identity_map = Hash.new do |h,model| | |
resource = h[model.base_model] | |
# set the IM if the resource's model is an ancestor of model | |
h[model] = resource if resource.model >= model | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::BootLoader.after_app_loads do | |
DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, Merb.logger.level) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dkubb [12:34 PM] | |
I feel solnic’s pain in trying to swim against the current | |
dkubb [12:44 PM] | |
https://twitter.com/dkubb/status/608359066172313600 | |
Dan Kubb@dkubb | |
.@rubyfive @_solnic_ has done great things for ruby, and your dismissive tone to his valid criticism only hurts the community. | |
Today at 12:44 PM | |
mbj [12:47 PM] |
OlderNewer