Skip to content

Instantly share code, notes, and snippets.

@rinmu
rinmu / ranking.rb
Created September 27, 2012 10:15 — forked from ppworks/ranking.rb
配列の要素をランキングする
#!/usr/bin/env ruby
def ranks scores
rank = scores.sort.reverse
scores.map{|n| rank.index(n) + 1}
end
ranks([100, 80, 90, 90, 90, 70, 70, 80]) # => [1, 5, 2, 2, 2, 7, 7, 5]
@rinmu
rinmu / about
Created July 24, 2012 01:22 — forked from naoty/about
cui-about.me client
#!/usr/bin/env ruby
require 'thor'
class CuiAboutMeClient < Thor
ROOT_PATH = 'http://cui-about.me'
desc 'me', 'curl http://cui-about.me'
def me
system "curl #{ROOT_PATH}"