Skip to content

Instantly share code, notes, and snippets.

@0x0dea
Created August 16, 2015 06:41
Show Gist options
  • Save 0x0dea/4830a46e7b2502efe160 to your computer and use it in GitHub Desktop.
Save 0x0dea/4830a46e7b2502efe160 to your computer and use it in GitHub Desktop.
def _(&b)$><<->(x){x ? (String===x ?x.upcase:
(Class===x ? x : x.class).name[$a?0:($a=5)]):
" "}[ begin b[];rescue Exception;$!;end ] end
_ { return } # LocalJumpError
_ { method(:p).unbind } # UnboundMethod
_ { eval "{ " } # SyntaxError
_ { Thread.current.join } # Thread
_ { nil }
_ { select } # ArgumentError
_ { ruby } # NoMethodError
_ { self.class } # Object
_ { Thread.current.group } # ThreadGroup
_ { nil.to_h } # Hash
_ { "\xFF".encode("big5") } # Encoding::InvalidByteSequenceError
_ { raise } # RuntimeError
_ { [0][1] }
_ { Regexp.compile "*" } # Regexp
_ { RUBY_COPYRIGHT[32] } # Yukihiro Matsumoto
_ { binding } # Binding
_ { :s.class.name[1] } # Symbol
_ { warn }
_ { [a: :b][0] } # Hash
_ { methods } # Array
_ { IO.class } # Class
_ { {}.fetch(0) } # KeyError
_ { open " " } # Errno::ENOENT
_ { 1000000.chr } # RangeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment