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
| <html> | |
| <head> | |
| <title>QR</title> | |
| </head> | |
| <body> | |
| <form action="http://localhost/cgi-bin/qr.rb" method="post"> | |
| <textarea name="t" cols="80" rows="15"> | |
| </textarea> | |
| <input type="submit" name="QR" value="QR" /> | |
| </form> |
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 Enumerable | |
| class Reverse | |
| def initialize(value) | |
| @value = value | |
| end | |
| attr_reader :value | |
| def <=>(other) | |
| - (@value <=> other.value) | |
| 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 'hpricot' | |
| require 'open-uri' | |
| require 'erb' | |
| class PokemonCardCom | |
| def host | |
| 'http://www.pokemon-card.com' | |
| 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 'pp' | |
| class MyPP | |
| def self.pp(obj, size, tail=' ...') | |
| s = self.new(size, tail) | |
| catch(:done) {PP.pp(obj, s)} | |
| s.to_s | |
| end | |
| def initialize(size, tail='') |
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 'erb' | |
| class ERB | |
| class ERBString < String | |
| def to_s; self; end | |
| def erb_concat(s) | |
| if self.class === s | |
| concat(s) | |
| else |
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 'drb' | |
| require 'pp' | |
| require 'net/https' | |
| require 'oauth' | |
| require 'json' | |
| class JSONStream | |
| def initialize(drop) | |
| @buf = '' | |
| @drop = drop |
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 'stringio' | |
| class BPlistParser | |
| def self.parse_file(fname) | |
| File.open(fname) do |fp| | |
| self.new(fp).top_object | |
| end | |
| end | |
| def initialize(io) |
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 'simple-oauth' | |
| require 'drb' | |
| require 'pp' | |
| require 'json' | |
| MyDrip = DRbObject.new_with_uri('drbunix:' + File.expand_path('~/.drip/port')) | |
| class JSONStream | |
| def initialize(drip) | |
| @buf = '' |
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 Bag | |
| def initialize | |
| @bag = Hash.new(0) | |
| @size = 0 | |
| @cache = nil | |
| end | |
| attr_reader :size | |
| def push(obj) | |
| @cache = nil |
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 'thread' | |
| class ActorsOffice | |
| def initialize(actor) | |
| @queue = Queue.new | |
| @thread = Thread.new(actor) do | |
| catch(actor) do | |
| while true | |
| msg, arg, blk = @queue.pop | |
| actor.__send__(msg, *arg, &blk) |