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
В случае появляющийся через раз ошибки, нужно в первую очередь проверить, что во всех случаях выполняется один и тот же код. Если код может выполняться на нескольких машинах, то необходимо проверить, что все они настроены должным образом и в памяти не висят запущенными старые процессы, выполняющие старый код (в случае с менеджером очередей). |
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
"http://www.example.com?" + { language: "ruby", status: "awesome" }.to_query | |
# => "http://www.example.com?language=ruby&status=awesome" |
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/ips" | |
Benchmark.ips do |x| | |
x.report("fast") { fast } | |
x.report("slow") { slow } | |
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
dev group gems: | |
spring | |
rack-mini-profiler | |
bullet | |
pry-rails | |
pry-debugger | |
pry-rescue | |
pry-stack_explorer |
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
rbenv must have plugins: rbenv-gem-rehash, rbenv-bundle-exec |
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
(1..10).each_slice(3) {|a| p a} | |
# outputs below | |
[1, 2, 3] | |
[4, 5, 6] | |
[7, 8, 9] | |
[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
numbers.map {|n| n*n}.reduce(:+) |
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
email, username = data.values_at('email', 'nickname') |
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
Tempfile.open('temp') {|file| p file.path } |
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 set_name(params) | |
@name = params.fetch(:name) rescue 'Anonymous' | |
end |
NewerOlder