Skip to content

Instantly share code, notes, and snippets.

@nsave
nsave / index.rb
Created November 21, 2018 10:51
Stop including Enumerable, return Enumerator instead (https://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/)
def your_method_name_which_is_usually_each(*args)
return enum_for(:your_method_name_which_is_usually_each, *args) unless block_given?
# go crazy
end
@nsave
nsave / hr_order.rb
Created November 21, 2017 19:36
Rails code example
# == Schema Information
#
# Table name: orders
#
# id :integer not null, primary key
# eid :string(255)
# location_id :integer
# customer_id :integer
# created_at :datetime
# creator_client_id :integer
@nsave
nsave / transliteration.yml
Created October 11, 2015 11:29
Rails russian transliteration.yml
en:
i18n:
transliterate:
rule:
а: a
б: b
в: v
г: g
д: d
е: e