This file contains hidden or 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' | |
def measure_do | |
result = Benchmark.measure do | |
yield | |
end | |
puts Benchmark::CAPTION | |
puts result | |
end |
This file contains hidden or 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 './process_measure.rb' | |
# ------------------------------ | |
def print_enable_combinarion(from, to) | |
(from..to).each do |num| | |
nums = num.to_s.split('') | |
puts num if enable_combinarion?(nums) | |
end | |
end |
This file contains hidden or 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 './process_measure.rb' | |
# ------------------------------ | |
def search_reversible_num(offset) | |
i = offset; | |
loop do | |
n2 = i.to_s(2) |
This file contains hidden or 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
# ref: | |
# http://blog.kymmt.com/entry/hook-by-alias-chaining-in-ruby | |
# http://miyohide.hatenablog.com/entry/2014/02/28/203743 | |
module AddLogging | |
def self.included(base) | |
base.extend HookMethod | |
end | |
module HookMethod |
NewerOlder