(draft; work in progress)
See also:
- Compilers
- Program analysis:
- Dynamic analysis - instrumentation, translation, sanitizers
(draft; work in progress)
See also:
I hereby claim:
To claim this, I am signing this object:
| module Cinch | |
| module Plugin | |
| module ClassMethods | |
| def enable_acl | |
| hook(:pre, :for => [:match], :method => lambda {|m| check_acl(m)}) | |
| end | |
| end | |
| def check_acl(message) | |
| shared[:acl].check(message, self) |
| 2012/07/11 20:28:02 * You inflict 1477 (1477) points of magic damage on Roaring Torbak. | |
| 2012/07/11 20:28:02 * You inflict 1477 (1477) points of magic damage on Gruff Mektoub. | |
| 2012/07/11 20:28:02 * You inflict 243 (1477) points of magic damage on Roaring Torbak. | |
| 2012/07/11 20:28:02 * You inflict 1034 (1477) points of magic damage on Gruff Rendor. |
| module Cinch | |
| module Plugins | |
| class PluginManagement | |
| include Cinch::Plugin | |
| match(/plugin load (\S+)(?: (\S+))?/, method: :load_plugin) | |
| match(/plugin unload (\S+)/, method: :unload_plugin) | |
| match(/plugin reload (\S+)(?: (\S+))?/, method: :reload_plugin) | |
| match(/plugin set (\S+) (\S+) (.+)$/, method: :set_option) | |
| def load_plugin(m, plugin, mapping) |
| #!/usr/bin/env ruby | |
| # Extended Mind | |
| # Wikipedia checker, the concept is that for any Wikipedia article you can | |
| # eventually get to the article on Philosophy if you click the first link | |
| # on the article. | |
| # http://xkcd.com/903 (see alt text) | |
| require 'open-uri' | |
| require 'nokogiri' |
| require 'benchmark' | |
| var = "a_string" | |
| TIMES = 1_000_000 | |
| Benchmark.bmbm do |x| | |
| x.report("//") do | |
| TIMES.times { /a#{var}b/ } | |
| end | |
| # note: this regexp will only be built once for all iterations |
| require 'benchmark' | |
| TIMES = 1_000_000 | |
| s = "a string" | |
| Benchmark.bmbm do |x| | |
| x.report("delete") do | |
| TIMES.times { s.delete("rin") } | |
| end |
| require 'benchmark' | |
| TIMES = 1_000_000 | |
| s = "a string" | |
| Benchmark.bmbm do |x| | |
| x.report("delete") do | |
| TIMES.times { s.delete(" ") } | |
| end |
| require 'benchmark' | |
| TIMES = 1_000_000 | |
| r = /regexp/ | |
| s = "regexp" | |
| Benchmark.bmbm do |x| | |
| x.report("r =~ s") do | |
| TIMES.times { r =~ s } |