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
| <?php | |
| class Renge { | |
| public function __construct($params = ['seed' => NULL, 'delimiter' => NULL]) { | |
| $this->seed = $params['seed']; | |
| $this->delimiter = $params['delimiter']; | |
| } | |
| public function encode($string) { | |
| $table = $this->convert_table(['for' => 'encode']); | |
| foreach ($this->unpack_U($string) as $char) { |
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 C | |
| attr_accessor :age | |
| def initialize(&block) | |
| instance_eval(&block) | |
| end | |
| def name(string) | |
| @name = string | |
| 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 'open_jtalk' | |
| require 'tmpdir' | |
| require 'readline' | |
| class Talk | |
| def start | |
| tmpdir = Dir.mktmpdir('syaberu.rb') | |
| while string = Readline.readline('> ', true) | |
| say(string, tmpdir) | |
| 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 'logger' | |
| module AwesomeGem | |
| # ใญใฌใผใๅฎ็พฉ | |
| # ใญใฐใฏๆจๆบใจใฉใผๅบๅ(STDERR)ใธๅบๅใใใ | |
| @@log ||= Logger.new(STDERR).tap do |log| | |
| # ใญใฐใซ่จ้ฒใใใใขใใชใฑใผใทใงใณๅ | |
| log.progname = 'AwesomeGem' |
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 'n_cipher/argument_validation' | |
| class Configuration | |
| include NCipher::ArgumentValidation | |
| def initialize(hash, &block) | |
| hash.each(&method(:set_attribute)) | |
| hash.each(&method(:define_accessor)) | |
| define_reseter(hash) | |
| yield(self) if block_given? |
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 'n_cipher/argument_validation' | |
| class Configuration | |
| include NCipher::ArgumentValidation | |
| def initialize(hash) | |
| hash.each_pair(&method(:define_accessor)) | |
| define_singleton_method(:reset) { initialize(hash); self } | |
| 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
| #!/usr/bin/env ruby | |
| require 'optparse' | |
| require 'logger' | |
| Version = 'v0.1.0' | |
| Release = '2016-02-07' | |
| Signal.trap(:INT) { exit(1) } | |
| logger = Logger.new(STDERR) |
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' | |
| data = DATA.each_with_object(Struct.new(:speaker, :quote)).map {|line, quote| | |
| r = line.split("\t").map {|pair| pair.chomp.split(':') }.to_h | |
| quote.new(r['speaker'], r['quote']) | |
| } | |
| pp data | |
| .group_by {|row| row.quote[-1] } | |
| .map {|group| group[1].map!(&:quote); group } |
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
| puts DATA.map(&:chomp).sample | |
| __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
| ๆฎบไบบ =-> ใใใใจ { ใใใใจ =~ /ๆฎบไบบ/ } | |
| ๆฎบไบบใใใชใใใค =-> ใใใใจ { ๆฎบไบบ.(ใใใใจ).! } | |
| ใใฎๅญไฝใใใใ ใใใญ๏ผ =-> ใใใใจ { | |
| case ใใใใจ | |
| when ๆฎบไบบ | |
| 'ใขใใ๏ผใใใๆใใใ๏ผ' | |
| when ๆฎบไบบใใใชใใใค | |
| 'ๅบใ๏ผ' | |
| end |