Skip to content

Instantly share code, notes, and snippets.

@gxespino
gxespino / .rspec
Created Jul 23, 2015
Analyzing Shakespeare
View .rspec
--color
--require spec_helper
--format documentation
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
View checkout.rb
RULES = { "A" => 50,
"B" => 30,
"C" => 20,
"D" => 15
}
DISCOUNTS = { "A" => [3, 20],
"B" => [2, 15]
}
View gist:c7a73d08d1b269f3d815
{
"font_size": 10.0,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
"theme": "Soda Dark.sublime-theme",
"translate_tabs_to_spaces": true
}
@gxespino
gxespino / ProgrammingManifesto.md
Last active Feb 4, 2021
Glenn's Path to Becoming a Ruby/Rails Programmer (Sept 2014 - Sept 2015)
View ProgrammingManifesto.md

#Programming Manifesto

##Books Ruby

  • Learn to Program by Chris Pine
  • The Well-Grounded Rubyist by David Black
  • Eloquent Ruby by Russ Olsen
  • Practical Object-Oriented Design in Ruby by Sandi Metz
  • Confident Ruby by Avdi Grimm
@gxespino
gxespino / Campaign.rb
Last active Aug 29, 2015
Perk form bug
View Campaign.rb
class Campaign < ActiveRecord::Base
belongs_to :user
has_many :perks
accepts_nested_attributes_for :perks, :reject_if => :all_blank, :allow_destroy => true
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"]
has_attached_file :photo_id, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"]