Google calculator response to "once in a blue moon"
Posted by root Fri, 04 Jul 2008 13:46:00 GMT
Results in the following:
once in a blue moon = 1.16699016 × 10-8 hertz
Can be tested here
Posted by root Fri, 04 Jul 2008 13:46:00 GMT
Results in the following:
once in a blue moon = 1.16699016 × 10-8 hertz
Can be tested here
Posted by root Mon, 30 Jun 2008 07:33:00 GMT
Charts for a map (in this example I’ve included Spain, France, Italy and Norway):
more about this API
Posted by root Mon, 16 Jun 2008 12:49:00 GMT
# negative - spawning a new shell
mkdir -p $1 && cd $1 && $SHELLPosted by root Mon, 16 Jun 2008 08:57:00 GMT
class Object
def arguments?(*methods)
methods.each do |method|
begin
rval = self.method(method).arity
if rval > 0
puts "'#{method}' takes fixed (#{rval}) number of argument"
elsif rval < 0
puts "'#{method}' takes variable number of arguments"
elsif rval == 0
puts "'#{method}' takes no arguments"
end
rescue
puts $!
end
end
end
end
String.new.arguments?(:size, :to_i, :scan, :flatten)
Posted by root Sat, 14 Jun 2008 13:45:00 GMT
class MyString < String
# not really useful
alias + concat
# emulates Array '*' method
def *(string)
self.split('').inject('') do |s1,c|
s1 + c + string
end
end
# emulates Array '-' method
def /(string)
(self.split('') - string.split('')).to_s
end
# chars' delimiter
def delimiter(string)
self.*(string).sub /.$/, ''
end
end
a = MyString.new("abcdef")
b = MyString.new("ABCDEF")
puts a * ':'
puts a / (b + "a")
puts a.delimiter(":")
#a:b:c:d:e:f:
#bcdef
#a:b:c:d:e:f