- 入力が楽→入力する文字数が少ない→入力した文字と変換キーを押した回数を記録すれば(文字列については)高効率に圧縮できるんじゃね?
- 圧縮したあとの文字列も日本語風になるからそれを既存の圧縮方式でさらに圧縮することも可能(?)
- 入力文字は半角カナで、変換キー押下回数はそのまま数字で。英数字や珍しい漢字、特異な顔文字は制御文字に挟んで平文で。
| module Mishuna | |
| def self.mishuna(_isan, ary) | |
| isan = _isan | |
| size = ary.size | |
| half_min = ary.min / 2 | |
| sum = ary.inject(&:+) | |
| if isan <= half_min * size | |
| return [ isan/size ]*size | |
| elsif isan <= sum - half_min * size | |
| new_ary = [] |
| class Array | |
| protected | |
| attr_accessor :matrix | |
| public | |
| def sort_with_matrix | |
| item_with_index = self.map.with_index { |item,i| [item,i] } | |
| item_with_index.sort_by! { |item,i| item } | |
| new_array = [] | |
| matrix = [] |
| module Foo | |
| def self.hoge | |
| fuga | |
| end | |
| def fuga | |
| 'bar' | |
| end | |
| end |
| require 'nokogiri' | |
| def mobilizer(page) | |
| page = Nokogiri::HTML(page.to_s) if page.class == String | |
| remove_tags = ['script', 'style', 'select', 'a'] | |
| remove_tags.each do |tag| | |
| page.xpath('//' + tag).each { |n| n.remove } | |
| end | |
| path = identifier(page, '/html/body') |
| require 'net/http' | |
| require 'uri' | |
| utid13 = 'your id' | |
| password = 'your password' | |
| url = 'https://webauth03.cc.tsukuba.ac.jp:8443/cgi-bin/adeflogin.cgi' | |
| res = Net::HTTP.post_form(URI.parse(url), {'name' => utid13, 'pass' => password }) | |
| puts res.body.scan(/Login.+?</) do |match| |
| #usage: xpath = mobilizer(html) | |
| require 'nokogiri' | |
| require 'kconv' | |
| def search_equal(pathes) | |
| return pathes[0] if pathes.size == 1 | |
| pathes.map! { |path| path.split('/') } | |
| fullsize = pathes.size | |
| path = [] |
| #coding: UTF-8 | |
| loop do | |
| num = gets.chomp | |
| #puts num | |
| puts 'ERROR 'if num.length != 6 | |
| puts ( if /97085$/ =~ num | |
| '1等' | |
| elsif /2344$/ =~ num | |
| '2等' | |
| elsif /(72|74)$/ =~ num |
| # coding: UTF-8 | |
| require "./tools2" | |
| require "pp" | |
| require 'json' | |
| require "nokogiri" | |
| VCard.set_ua | |
| baseurl = "http://vcard.ameba.jp/battle/battle-detail?enemyId=" | |
| 10.times do | |
| io = VCard.getio("/battle/ajax/battle-user-search?cond=level") |
| # coding: UTF-8 | |
| #require "./tools" | |
| require "open-uri" | |
| require "pp" | |
| require "nokogiri" | |
| class VCard | |
| @@cookie_changed = true | |
| @@cookies = {} | |
| @@ua = "" |