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 Rake::Task | |
| def overwrite(&block) | |
| abandon | |
| enhance(&block) | |
| end | |
| def abandon | |
| @actions.clear | |
| prerequisites.clear |
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
| #!/usr/bin/ruby | |
| %w(rubygems socket yaml).each { |lib| require lib } | |
| class Bot | |
| attr_reader :nick, :server, :port, :options, :server_info, :server_message | |
| def initialize(nick, server, port, options = {}, &block) | |
| @nick = nick | |
| @server = server | |
| @port = port |
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
| # [ Fixnum, Float ].each{ |klass| klass.send :include, Extensions::NetAndGross } | |
| # | |
| # Examples: | |
| # 1.net # => 1 | |
| # 1.gross # => 1.19 | |
| # 1.gross.gross # => 1.19 | |
| # 1.gross.gross.net # => 1.0 | |
| # | |
| module Extensions |
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
| cmyk = Hash.new do |cache, rgb| | |
| cmy = rgb.map { |color| 255 - color } | |
| k = cmy.min | |
| cache[rgb] = cmy.map { |color| color - k } + [k] | |
| end | |
| # Usage | |
| cmyk[ [128, 42, 23] ] # => [0, 86, 105, 127] |
NewerOlder