- Ctrl + Q Delete entire command
- Ctrl + W Delete one word back
- Ctrl + E Moves to the end of the command
- Ctrl + R Search back in command history
- Ctrl + A Moves to beginning of command
- Ctrl + D Works like delete
This file contains hidden or 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
class SinatraWebService | |
attr_reader :services | |
def initialize | |
@services = [] | |
end | |
end |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
lib = File.expand_path('../lib/', __FILE__) | |
$:.unshift lib unless $:.include?(lib) | |
require 'bundler/version' | |
Gem::Specification.new do |s| | |
s.name = "bundler" | |
s.version = Bundler::VERSION | |
s.platform = Gem::Platform::RUBY |
This file contains hidden or 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
Dan Pickett | |
David Trasbo |
This file contains hidden or 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
class Car < ActiveRecord::Base | |
named_scope :color, lambda { |color| {:conditions => {:color => color }} } | |
named_scope :by_age, :order => 'created_at' | |
end | |
Car.color('red').by_age # returns all cars where color equals red ordered by age |
This file contains hidden or 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
# This: | |
require 'rails/generators' | |
Rails::Generators.fallbacks[:shoulda] = :test_unit | |
# and this: | |
config.generators do |g| | |
g.fallbacks[:shoulda] = :test_unit | |
end |
This file contains hidden or 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
class TheUppermostClass | |
def initialize(one, two, three, four) | |
end | |
end | |
class TheInheritingClass < TheUppermostClass | |
def initialize(one, two, three) | |
super(one, two, three, 'four') | |
end | |
end |
This file contains hidden or 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
class Person < ActiveRecord::Base | |
belongs_to :country | |
scope :minor, proc { where('birthday >= ?', 18.years.ago) } | |
scope :adult, proc { where('birthday <= ?', 18.years.ago) } | |
scope :male, where(gender: 'male') | |
scope :female, where(gender: 'female') | |
def self.living_in(country) |
This file contains hidden or 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
1_000.times do |i| | |
File.open('test.txt', 'a+') do |f| | |
f.write File.read('lipsum.txt') | |
end | |
puts "written #{i} time(s)" | |
sleep 0.5 | |
end |