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
| # -*- coding: utf-8 -*- | |
| require 'rspec' | |
| class LRUCache | |
| attr_reader :order, :capacity | |
| def initialize(capacity) | |
| @capacity = capacity | |
| @order = [] | |
| @hash = {} |
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
| # -*- coding: utf-8 -*- | |
| require 'rspec' | |
| describe "stdout" do | |
| def substitute_stdout | |
| mock = double('stdout') | |
| yield mock | |
| $stdout = mock | |
| 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
| # -*- coding: utf-8 -*- | |
| require 'yaml' | |
| require 'logger' | |
| require 'net/http' | |
| require 'twitter' | |
| LOG = Logger.new('log') | |
| LISTS = [22926920, 22919856, 22917276, 22914957, 22912272, 22898839] | |
| USER= 'niku_name' |
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 'rspec' | |
| describe do | |
| it do | |
| ary = [:one, :two] | |
| context(ary) do | |
| send(:[],0) | |
| end.should == :one | |
| end | |
| it do |
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
| # -*- coding: utf-8 -*- | |
| class Array | |
| def delete_each target | |
| self.inject([]) do |result, check| | |
| if index = target.find_index(check) | |
| target.delete_at(index) | |
| else | |
| result << check | |
| end | |
| result |
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
| # -*- coding: utf-8 -*- | |
| require 'forwardable' | |
| Address = Struct.new :x, :y do | |
| def self.[] x,y # Address[x,y] | |
| Address.new x,y | |
| end | |
| def adjoinings # 隣接アドレス | |
| x,y = self.x, self.y |
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: RSS::load | |
| config: | |
| url: | |
| - http://sirase.ru/consadole/news.rdf | |
| - http://sirase.ru/consadole/snews.rdf | |
| - http://sirase.ru/consadole/consa-burn.rdf | |
| - http://sirase.ru/consadole/forza_consadole.rdf | |
| - http://sirase.ru/consadole/hochi_consadole.rdf | |
| - http://www.nikkansports.com/rss/soccer/jleague/consadole.rdf | |
| - module: Filter::deduped |
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
| # -*- coding: utf-8 -*- | |
| # How To Use | |
| # | |
| # required three sources | |
| # +-idm2kpx.rb(this) | |
| # +-idm_parser.rb | |
| # +-idm.xml('ID Manager' exported) | |
| # | |
| # %ruby idm2kpx.rb idm.xml keypassx.xml | |
| # |
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: const_list | |
| config: | |
| - http://hochi.yomiuri.co.jp/soccer/jleague/ | |
| - module: Filter::get_html | |
| - module: Filter::find_regex | |
| config: | |
| regex: <a href="\/soccer\/jleague\/news\/.+?\.htm">.+?…札幌<\/a> | |
| - module: Filter::subs | |
| config: | |
| regex: <a href="(\/soccer\/jleague\/news\/.+?\.htm)">.+?…札幌<\/a> |
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: const_list | |
| config: | |
| - http://www.hokkaido-np.co.jp/cont/consa-burn/index_all.html | |
| - module: Filter::get_html | |
| - module: Filter::find_regex | |
| config: | |
| regex: http:\/\/www\.hokkaido-np\.co\.jp\/cont\/consa-burn\/\d+?\.html | |
| - module: Filter::deduped | |
| config: | |
| path: /virtual/niku/pragger_makes/deduped/consa-burn |