This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Poker | |
| NO_PAIR = 0 | |
| ONE_PAIR = 1 | |
| TWO_PAIR = 2 | |
| THREE_OF_KIND = 3 | |
| STRAIGHT = 4 | |
| FLUSH = 5 | |
| FULL_HOUSE = 6 | |
| FOUR_CARD = 7 | |
| STRAIGHT_FLUSH = 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def generate | |
| sei = %w(山 川 谷 柳 大 小 地 高 吉 沢 田 中 畑 木 森 林 松 浜 滝 宮 橋 鈴 藤 石 池 島 岡 村 町 上 下 崎 野 坂 塚 本 竹 岡 西 東 杉 原 内 尾 吉 倉 堀 井).sort_by{rand} | |
| mei1 = %w(安 高 彩 遙 秀 優 愛 涼 桃 由 雪 健 賢 憲 順 純 貴 真 清 晴 聖 舞 夕 朝 理 利 祐 裕 洋 陽 広 友 雅 正 京 和 久 知 智 紀 康 幸 明 響 恭 春 夏 秋 冬).sort_by{rand} | |
| mei2 = %w(美 子 里 奈 香 佳 恵 乃 代 依 之 文 夫 志 治 士 郎 史 司 彦 平 也 一 二 三).sort_by{rand} | |
| names = [] | |
| sei.each do |s1| | |
| sei.each do |s2| | |
| mei1.each do |m1| | |
| mei2.each do |m2| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'jcode' | |
| $KCODE='u' | |
| page_content = Struct.new('PageContent', :category, :title, :body, :updated_at) | |
| content = Nokogiri::HTML.parse(open('http://www.libro.jp/news/').read) | |
| contents = content.xpath("//div[@class='entry']").map do |entry| | |
| page = page_content.new( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def queryize(hash) | |
| require 'cgi' unless defined?(CGI) && defined?(CGI::escape) | |
| hash.map{|i| i.map {|j| CGI.escape j.to_s}.join('=') }.join('&') | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://mrss.dokoda.jp/a/http/b.hatena.ne.jp/entrylist?sort=hot&threshold=300&url=http%3A%2F%2Fanond.hatelabo.jp&mode=rss |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'sinatra' | |
| require 'slim' | |
| module Sinatra | |
| module Templates | |
| def slim(template, options={}, locals={}) | |
| render :slim, template, options, locals | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'open-uri' | |
| require 'nokogiri' | |
| KCODE = 'euc-jp' | |
| index_url = 'http://www.dmm.co.jp/digital/videoa/-/actress/=/keyword=%s/' | |
| %w(a ka sa ta na ha ma ya ra wa).each do |w| | |
| content = Nokogiri::HTML.parse(open(index_url % w).read) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # -*- coding: utf-8; -*- | |
| # | |
| # scraping nikkei.com for Kindle | |
| # | |
| require 'nokogiri' | |
| require 'open-uri' | |
| TOP = 'http://www.nikkei.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Hoge | |
| def hello | |
| puts "hello" | |
| end | |
| end | |
| class Test | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // プラグイン呼び出し | |
| // | |
| $(function() { | |
| $.sample({debug:true}); | |
| }); | |
| // | |
| // プラグイン本体 |
OlderNewer