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 Klass | |
def public_method | |
end | |
private | |
def private_method1 | |
end | |
def private_method2 |
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
curl -XPOST 'http://localhost:9200/_aliases' -d ' | |
{ | |
"actions" : [ | |
{ "add" : { "index" : "articles-1", "alias" : "articles" } } | |
] | |
}' |
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
# Activate the gem you are reporting the issue against. | |
# gem install activerecord -v '3.2.19' | |
gem 'activerecord', '3.2.19' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) |
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
brazil = Spree::Country.where(name: "Brazil").last | |
Spree::State.create!( | |
[{name: "Acre", abbr: "AC", country: brazil}, | |
{name: "Alagoas", abbr: "AL", country: brazil}, | |
{name: "Amapá", abbr: "AP", country: brazil}, | |
{name: "Amazonas", abbr: "AM", country: brazil}, | |
{name: "Bahia", abbr: "BA", country: brazil}, | |
{name: "Ceará", abbr: "CE", country: brazil}, | |
{name: "Espírito Santo", abbr: "ES", country: brazil}, |
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
# | |
# Vayan a MagmaConf http://www.magmaconf.com | |
# | |
require 'minitest/autorun' | |
require 'minitest/pride' | |
class Animal | |
attr_accessor :clase |
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 'active_record' | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :orders do |t| | |
t.integer :total | |
t.string :lock_version | |
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
echo ".DS_Store" >> ~/.gitignore_global | |
git config --global core.excludesfile '~/.gitignore_global' |
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 Inflector | |
def self.pluralize(singular) | |
(singular == "country") ? "countries" : "#{singular}s" | |
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
source "https://rubygems.org" | |
gem "acts_as_shopping_cart" | |
gem "sqlite3" |
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 'benchmark' | |
# | |
# Code example for my blogpost | |
# | |
# Hash lookup in Ruby, why is it so fast? | |
# | |
# | |
# Struct used to store Hash Entries |