func.4 objects

進捗しない日記 プログラミングとか

Ruby

正規表現でFizzBuzz

昔書いたのが出てきたのでメモがてらに def f(n) puts [:fizzbuzz,:fizz,:buzz,n][("n"*n).scan(/^(n{15})*$|^(nnn)*$|^(n{5})*$|^(.*)$/).last.index{|n|n}] end 1.upto(100){|x|f(x)} う~ん気持ち悪い

ワンライナーで青空文庫検索

しょぼくても更新した方が良いなぁと思ったので。 #coding : utf-8 require 'net/http' require 'open-uri' require 'httpclient' p (HTTPClient.new).get_content("https://www.google.com/search?hl=ja&lr=lang_ja&ie=utf-8&num=20&complete=0&as_dt=i&as_…