各路大神用各路语言打印出来,虽然 ruby 不是得票最高的但我觉得是最喜庆的。。
准备好了么,lets go!
热身开始
p Time.new.year
一般般,毫无新意,继续
Happy = Time
Happy.new.year
还不错哈,但感觉一点都不生动!再来
Happy = Time
class Time; alias year! year; end
Happy.new.year!
或者再过分一点!
class Have; def self.a; A.new; end; end
class A; def happy; Time; end; end
class Time; alias year! year; end
Have.a.happy.new.year!
我擦,有点吊啊,但你语法不对啊,点是干嘛的
def noop x = nil; end
alias a noop
alias happy noop
alias new noop
alias year! noop
def Have x
p Time.new.year
end
Have a happy new year!
这都罩不住你?
def noop x = nil; end
eval %w[we wish you a merry christmas! christmas and a happy new].map{|x|"alias #{x} noop"}*"\n"
def year!; p Time.new.year; end
we wish you a merry christmas! we wish you a merry christmas!
we wish you a merry christmas and a happy new year!
祝大家新年快乐~
排名第 2 的 Python 版本也很 cool 啊,不过用 ruby 只要一个函数,感觉有点作弊,哈哈:
"Happy new year to you!".sum
Unicode Code Point 算不算
JavaScript:'\u07DE'.charCodeAt()
Ruby/Python/PHP:ord('\u07DE')
Java/CSharp:(int)'\u07DE'
16 进制字面量算不算 JavaScript/Ruby/Python/PHP/Java/CSharp:0x7DE
RUBY
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.length
js
_=++[[]][+[]],__=_+_,____=__+__,___=+[[]]
alert(__+''+___+''+_+''+____+'');
array = %W(zero one two three four) array.indexof('two').to_s + array.indexof('zero').to_s + array.indexof('one').to_s +array.indexof('four').to_s
p (Math.asin(Math.cos("a".to_i)).to_i<<(Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i))-(Math.asin(Math.cos("a".to_i)).to_i<<(Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i+Math.asin(Math.cos("a".to_i)).to_i))-(Math.asin(Math.cos("a".to_i)).to_i<<Math.asin(Math.cos("a".to_i)).to_i)
或者写正常一点……
z = Math.asin(Math.cos("a".to_i)).to_i
p (z<<(z+z+z+z+z+z+z+z+z+z+z))-(z<<(z+z+z+z+z))-(z<<z)