Skip to content

Instantly share code, notes, and snippets.

View rosylilly's full-sized avatar
🕊️
Happy Hacking

Sho Kusano rosylilly

🕊️
Happy Hacking
View GitHub Profile
@rosylilly
rosylilly / Object_overide.rb
Created February 3, 2009 20:57
Prototype class for ruby
class Object
def method_missing( _method, *arg)
_method = _method.to_sym
if (_method.to_s[_method.to_s.size - 1] == ?=) && ( arg[0].class == Proc)
target = (self.class == Class ? self : self.class)
target.class_eval do
define_method( _method.to_s[0, _method.to_s.size - 1].to_sym, arg[0].binding)
end
else
raise NoMethodError, "undefined method `#{_method}' for #{self.inspect}:#{self.class}", caller(1)
class CS5
Pseudo_Classes = [
/root/,
/nth\-child\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-last\-child\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-of\-type\((\d+n\+\d+|\d+|odd|even)\)/,
/nth\-last\-of\-type\((\d+n\+\d+|\d+|odd|even)\)/,
/first\-child/,
/last\-child/,
/first\-of\-type/,