This file contains 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 | |
$KCODE = 'utf8' | |
# 漢数字を数値に変換する | |
# | |
# * http://ja.wikipedia.org/wiki/%E6%BC%A2%E6%95%B0%E5%AD%97 | |
# * http://www.akatsukinishisu.net/kanji/kansuji.html | |
module Kansuji | |
This file contains 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
String.prototype.bytes = function() { | |
var count = 0; | |
for (var i = 0; i < this.length; i++) { | |
count += Math.ceil(encodeURIComponent(this.charAt(i)).length / 3) | |
} | |
return count; | |
}; |
This file contains 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
# config/initializers/action_cache.rb | |
module ActionController::Caching::Actions::ClassMethods | |
# ex) continue filter chain | |
# | |
# caches_action :action_name, :continue => true | |
# | |
def caches_action(*actions) | |
return unless cache_configured? |
This file contains 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
diff --git a/lib/jpmobile.rb b/lib/jpmobile.rb | |
index af7ac4c..d18ca28 100644 | |
--- a/lib/jpmobile.rb | |
+++ b/lib/jpmobile.rb | |
@@ -20,8 +20,32 @@ module Jpmobile | |
autoload :Livedoor, 'jpmobile/mobile/livedoor' | |
autoload :Goo, 'jpmobile/mobile/goo' | |
- def self.constants_with_discovery_order | |
- [ :Google, :Yahoo, :Livedoor, :Goo, :Docomo, :Au, :Softbank, :Vodafone, :Jphone, :Emobile, :Willcom, :Ddipocket ] |
This file contains 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
diff --git a/lib/jpmobile.rb b/lib/jpmobile.rb | |
index af7ac4c..d18ca28 100644 | |
--- a/lib/jpmobile.rb | |
+++ b/lib/jpmobile.rb | |
@@ -20,8 +20,32 @@ module Jpmobile | |
autoload :Livedoor, 'jpmobile/mobile/livedoor' | |
autoload :Goo, 'jpmobile/mobile/goo' | |
- def self.constants_with_discovery_order | |
- [ :Google, :Yahoo, :Livedoor, :Goo, :Docomo, :Au, :Softbank, :Vodafone, :Jphone, :Emobile, :Willcom, :Ddipocket ] |
This file contains 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
Index: scripts/emoji_scrape.rb | |
=================================================================== | |
--- scripts/emoji_scrape.rb (リビジョン 18881) | |
+++ scripts/emoji_scrape.rb (作業コピー) | |
@@ -77,17 +77,18 @@ | |
end | |
def self.scrape_thirdforce | |
- base_uri = 'http://developers.softbankmobile.co.jp/dp/tool_dl/web/' | |
+ base_uri = 'http://creation.mb.softbank.jp/web/' |
This file contains 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
Index: test/filter_test.rb | |
=================================================================== | |
--- test/filter_test.rb (リビジョン 18934) | |
+++ test/filter_test.rb (作業コピー) | |
@@ -7,8 +7,16 @@ | |
test 'filter a tag' do | |
term = flexmock("term") | |
term.should_receive(:get_carrier).and_return(SSB::KtaiSpec::CARRIER_DOCOMO) | |
- expected = %Q{<a href=\"./?ssb_q=http%3A%2F%2Fexample.com%3A80%2Fbar\" target=\"_top\">foo</a>} | |
- filtered = SSB::Application.filter_html("<a href='/bar'>foo</a>", URI.parse('http://example.com/foo'), term, '') |
This file contains 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
# ssb を Rack に対応させる | |
require 'rubygems' | |
require 'rack' | |
require 'webrick' | |
class Rack::Request | |
alias_method :origin_cookies, :cookies | |
def query |
This file contains 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 File.join(File.dirname(__FILE__), 'config', 'common.rb') | |
require 'ssb' | |
require 'ssb/rack' | |
# mod_passenger の場合の対応 | |
unless ENV['RACK_ENV'] | |
# mod_passenger だと、env['CONTENT_LENGTH'] が文字列で入らない様子 | |
use Rack::Lint | |
# mod_passenger は static なファイルは標準でファイル読み込みになる | |
# * RackBaseURI を使って DocumentRoot と アプリケーションエンドポイントが異なる場合に上手く行かない |
This file contains 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
# SSBをRack::AdapterでRackに対応させる試み | |
require 'rubygems' | |
require 'rack' | |
require 'ostruct' | |
require 'webrick' | |
module Rack | |
module Adapter | |
OlderNewer