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) | |
s = ['+', '-', '*', '/', ''] | |
(from..to).each do |num| | |
a = num.to_s.split("") | |
[a[0]].product(s, [a[1]], s, [a[2]], s, [a[3]]) do |c| | |
next if abort?(str = c.join) |
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
class RenderObserver < Rails::Railtie | |
@rendered = Set.new([]) | |
config.after_initialize do | |
ActiveSupport::Notifications.subscribe "render_template.action_view" do |*args| | |
data = args.extract_options! | |
unless @rendered.include?(data[:identifier]) | |
puts "#{data[:identifier]}" | |
@rendered.add(data[:identifier]) | |
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
class NullObjectExample | |
require 'naught' | |
NullObject = Naught.build | |
def null_object | |
null = NullObject.new | |
null.foo # => nil | |
null.bar # => nil | |
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
# ---------- getting started ---------- | |
# gem install clockwork | |
# nohup clockwork clock.rb & | |
# ---------- stop process ---------- | |
# ps -x | grep clock | |
# kill [id] | |
require 'clockwork' | |
require 'net/http' |
OlderNewer