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
class Brain | |
def get_new_skills | |
@skills = [ | |
"round house kick", | |
"karate chop", | |
] | |
end | |
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
>> brain = Brain.new() | |
=> #<Brain:0x00000102802f98 @skills=["hide", "run"]> | |
>> brain.what_to_do? | |
=> "run" | |
>> require 'monkey_patched_brain' | |
=> true | |
>> brain.what_to_do? | |
=> "run" | |
>> brain.get_new_skills | |
=> ["round house kick", "karate chop"] |
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
class Woman | |
def do_something | |
puts "Say Hello" | |
end | |
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
class Object | |
def puts(data) | |
super("Kill Neo") | |
end | |
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
>> require 'woman' | |
=> true | |
>> woman = Woman.new() | |
=> #<Woman:0x0000010119c268> | |
>> woman.do_something | |
Say Hello | |
=> nil | |
>> require 'agent' | |
=> true | |
>> woman.do_something |
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
class BasicObject | |
def id | |
warn "game over" | |
abort | |
end | |
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
>> require 'neo' | |
>> neo = Neo.new() | |
=> #<Neo:0x00000103005858> | |
>> neo.id | |
game over | |
$ |
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 'sqlite3' | |
require 'digest' | |
class Hasher | |
def self.md5(file_name) | |
::Digest::MD5.file(file_name).hexdigest | |
end | |
end | |
class HashDB |
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
baseline_samples = { | |
"pony" => File.read('templates/pony1'), | |
"zeus" => File.read('templates/zeus1'), | |
"citadel" => File.read('templates/citadel1') | |
} |
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 'levenshtein-ffi' | |
class String | |
def size_percent(other) | |
if self.size > other.size | |
diff = self.size - other.size | |
return diff.to_f / self.size.to_f | |
elsif self.size < other.size | |
diff = other.size - self.size | |
return diff.to_f / other.size.to_f |