Skip to content

Instantly share code, notes, and snippets.

View ELLIOTTCABLE's full-sized avatar
🐫

ELLIOTTCABLE

🐫
View GitHub Profile
| thats | right | bitches |
| my | data | goes |
| in | a | big |
| mother | fucking | table |
libx264.c: In function 'X264_init':
libx264.c:165: error: 'x264_param_t' has no member named 'i_bframe_adaptive'
make[1]: *** [libx264.o] Error 1
make: *** [libavcodec/libavcodec.a] Error 2
-- mplayer -benchmark "./Rambo 4 - Rambo.mkv"
BENCHMARKs: VC:4151.460s VO:1459.424s A: 428.457s Sys:-4173.555s = 1865.786s
BENCHMARK%: VC:222.5046% VO: 78.2203% A: 22.9639% Sys:-223.6888% = 100.0000%
-- mplayer -benchmark -lavdopts fast:threads=4:skiploopfilter=all -framedrop -autosync 100 "./Rambo 4 - Rambo.mkv"
BENCHMARKs: VC:3440.842s VO:1185.973s A: 467.240s Sys:-3888.928s = 1205.127s
BENCHMARK%: VC:285.5169% VO: 98.4106% A: 38.7710% Sys:-322.6986% = 100.0000%
BENCHMARKn: disp: 117382 (97.40 fps) drop: 14260 (10%) total: 131642 (109.23 fps)
class Foo
def initialize &block
p instance_eval &block if block_given? # !> `&' interpreted as argument prefix
end
def const_missing const
"foobar"
end
end
Foo.new {self} # => #<Foo:0x27204>
module Refinery
##
# It's okay if you have no idea what the fuck this does - I don't either.
# Let's play with it!
def refine_method meth
end
private
foo = lambda {p 'foo'}
def gaz &block
block.call
end
bar = method(:gaz).to_proc # => #<Proc:0x00027b3c@-:5>
bar.call(foo)
# ~> -:10:in `gaz': wrong number of arguments (1 for 0) (ArgumentError)
# ~> from -:10:in `to_proc'
# ~> from -:6:in `call'
# ~> from -:6
class Nothing
def self.bar &block
p block
end
bar_as_block = method(:bar).to_proc
self.send :define_method, :bar_two, &bar_as_block
end
foo = lambda {p 'test'}
nothing = Nothing.new
@ELLIOTTCABLE
ELLIOTTCABLE / gist:13317
Created September 27, 2008 11:48
It's not quite 1337 )-:
module_eval("
def #{meth} *args, &block
ores[meth].each do |umeth|
umeth.bind(self).call(*args) &block
end
end
")
##
# This class exists to proffer the `refine_method` method.
# @see Refinery#refine_method
module Refinery
##
# This method re-defines another method in such a way as to make it
# 'invincible' - once done, any attempts to re-open the class and re-define
# the method later will simply 'stack' on top of existing code (assumably,
# code that you defined after refining the method) in such a way that the
p 'before'
class Foo
def self.method_added meth
p meth
end
def self.method_added meth
p [meth, 'whee']
end