Skip to content

Instantly share code, notes, and snippets.

View claudijd's full-sized avatar
🦬

Jonathan Claudius claudijd

🦬
View GitHub Profile
@claudijd
claudijd / monkey_patched_brain.rb
Created August 13, 2014 03:52
A monkey patch for Neo's brain
class Brain
def get_new_skills
@skills = [
"round house kick",
"karate chop",
]
end
end
@claudijd
claudijd / irb_session.txt
Created August 13, 2014 03:54
Neo's getting some new skills, yo
>> 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"]
@claudijd
claudijd / woman.rb
Created August 14, 2014 02:58
Woman in the red dress
class Woman
def do_something
puts "Say Hello"
end
end
@claudijd
claudijd / agent.rb
Created August 14, 2014 03:10
Agent taking control
class Object
def puts(data)
super("Kill Neo")
end
end
@claudijd
claudijd / irb_session.txt
Created August 14, 2014 03:14
Woman being taken over by an agent
>> require 'woman'
=> true
>> woman = Woman.new()
=> #<Woman:0x0000010119c268>
>> woman.do_something
Say Hello
=> nil
>> require 'agent'
=> true
>> woman.do_something
@claudijd
claudijd / neo.rb
Created August 14, 2014 03:33
Neo shutting down the Matrix
class BasicObject
def id
warn "game over"
abort
end
end
@claudijd
claudijd / irb_session.txt
Created August 14, 2014 03:40
Neo shutting down the Matrix
>> require 'neo'
>> neo = Neo.new()
=> #<Neo:0x00000103005858>
>> neo.id
game over
$
@claudijd
claudijd / hashdb.rb
Created August 28, 2014 13:01
A rough mock up of a Hash storage/retrieval container
require 'sqlite3'
require 'digest'
class Hasher
def self.md5(file_name)
::Digest::MD5.file(file_name).hexdigest
end
end
class HashDB
@claudijd
claudijd / baseline_strains.rb
Last active August 29, 2015 14:06
Baseline Strains
baseline_samples = {
"pony" => File.read('templates/pony1'),
"zeus" => File.read('templates/zeus1'),
"citadel" => File.read('templates/citadel1')
}
@claudijd
claudijd / test_samples.rb
Last active August 29, 2015 14:06
Test Stamples
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