Skip to content

Instantly share code, notes, and snippets.

View jasonnoble's full-sized avatar

Jason Noble jasonnoble

View GitHub Profile
puts 'Hello World!
@jasonnoble
jasonnoble / card.rb
Created February 26, 2015 03:40
Cards
class Card
CLUB = "\u2663"
DIAMOND = "\u2666"
SPADE = "\u2660"
HEART = "\u2764"
attr_reader :suit, :value
def initialize(suit, value)
@suit = suit
@value = value.to_s
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
puts "This is line one"
@jasonnoble
jasonnoble / cat.rb
Created February 5, 2015 03:30
My Cat Class
class Cat
def speak
"meow"
end
end
$ rake test:all_versions
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.5-compliant syntax, but you are running 2.1.2.
Warning: unrecognized cop Metrics/AbcSize found in /Users/jasonn/workspace/guard-rspec/.rubocop_todo.yml
Warning: unrecognized cop Metrics/AbcSize found in /Users/jasonn/workspace/guard-rspec/.hound.yml
Inspecting 31 files
...............................
31 files inspected, no offenses detected
@jasonnoble
jasonnoble / gist:72d02d6d456a8421e585
Created December 6, 2014 02:48
Error when running rails g rspec:install
$ rails g rspec:install
/Users/jasonn/.rvm/gems/ruby-2.1.4@rails4/gems/guard-rspec-4.4.1/lib/guard/rspec/options.rb:2:in `<module:Guard>': uninitialized constant Guard::Plugin (NameError)
from /Users/jasonn/.rvm/gems/ruby-2.1.4@rails4/gems/guard-rspec-4.4.1/lib/guard/rspec/options.rb:1:in `<top (required)>'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@rails4/gems/guard-rspec-4.4.1/lib/guard/rspec.rb:1:in `require'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@rails4/gems/guard-rspec-4.4.1/lib/guard/rspec.rb:1:in `<top (required)>'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:85:in `require'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:85:in `rescue in block in require'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:68:in `block in require'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.4/lib/bundler/runtime.rb:61:in `each'
from /Users/jasonn/.rvm/gems/ruby-2.1.4@globa
FactoryGirl.define do
factory :car do
make { Car::MAKES_AND_MODELS.keys.sample }
model { Car::MAKES_AND_MODELS[make].sample }
year { rand(1879..2014) }
price {
if [
"Aston Martin", "Bentley", "Ferrari",
"Lamborghini", "Maserati", "Maybach", "Rolls-Royce"
@jasonnoble
jasonnoble / gist:58569cec79135608639f
Created November 18, 2014 19:03
Makes and Models
MAKES_AND_MODELS = {"Acura"=>["MDX", "NSX", "RL", "RSX", "TL", "TSX"], "Aston Martin"=>["DB9", "V12 Vanquish"], "Audi"=>["A4", "A6", "A8", "S4", "TT", "allroad quattro"], "BMW"=>["3 Series", "5 Series", "6 Series", "7 Series", "M3", "X3", "X5", "Z4"], "Bentley"=>["Arnage", "Continental GT"], "Buick"=>["Century", "LaCrosse", "LeSabre", "Park Avenue", "Rainier", "Rendezvous", "Terraza"], "Cadillac"=>["CTS", "CTS-V", "DeVille", "Escalade", "Escalade ESV", "Escalade EXT", "SRX", "STS", "XLR"], "Chevrolet"=>["Astro", "Astro Cargo", "Avalanche", "Aveo", "Blazer", "Cavalier", "Classic", "Cobalt", "Colorado", "Corvette", "Equinox", "Express", "Express Cargo", "Impala", "Malibu", "Malibu Maxx", "Monte Carlo", "SSR", "Silverado 1500", "Silverado 1500HD", "Silverado 2500HD", "Silverado 3500", "Suburban", "Tahoe", "TrailBlazer", "TrailBlazer EXT", "Uplander", "Venture"], "Chrysler"=>["300", "Crossfire", "PT Cruiser", "Pacifica", "Sebring", "Town and Country"], "Dodge"=>["Caravan", "Dakota", "Durango", "Grand Caravan",
@jasonnoble
jasonnoble / gist:7d4cca06ed8f052f1a3e
Created November 18, 2014 01:42
Numbers to English
require 'rspec'
require_relative '../../lib/to_english'
describe Fixnum do
describe '#to_english' do
it 'returns one for 1' do
expect(1.to_english).to eq('one')
end
it 'returns two for 2' do
expect(2.to_english).to eq('two')