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
# if you blame this, you lose. | |
logger.debug("\e[0;31m Life is meaningful.\e[0;00m") if rand(100) == 42 # Fixed mongoid bug. |
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
require 'spec_helper' | |
describe CheckoutsController do | |
before :all do | |
puts 'running' | |
@counter ||= 0 | |
@counter += 1 | |
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
def reverse_count | |
(1..10).reverse_each do |i| | |
puts i | |
end | |
end | |
reverse_count | |
10 |
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
class ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
storage :file | |
version :thumb do | |
process :resize_to_fill => [200, 150] | |
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
before :each do | |
get :success | |
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
gem 'apn_sender', :require => 'apn' | |
gem 'daemons' |
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
# app/uploaders/avatar_uploader.rb | |
process :fix_exif_rotation | |
process :strip | |
process :resize_to_fill => [1024, 768] | |
process :quality => 90 # Percentage from 0 - 100 |
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
# WTF ? | |
product_image.url #=> TypeError Exception: can't convert nil into String | |
nil.to_s #=> "" |
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
require 'rspec' | |
require 'rspec/rails' | |
require 'rspec/autorun' # Required for Rcov to run. |
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
@addresses = [] | |
10000.times do | |
@addresses.push Faker::Internet::ip_v4_address | |
end | |
@addresses == @addresses.uniq # => true |