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 | |
| $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 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 'set' | |
| require 'rss' | |
| # キーワード集合を作成 | |
| # キーワードの長さ配列を作成 | |
| dictionary = Set.new | |
| size_list = [] | |
| # はてなキーワードの2カラム目を切り出して uniq したもの | |
| # curl -s http://d.hatena.ne.jp/images/keyword/keywordlist_furigana.csv | lv -Ou -Ie | cut -f2 | sort -u > keywordlist.tsv | |
| open('keywordlist.tsv') do |input| |
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
| # $ rails new <application name> -T -d postgresql --skip-spring -m heroku_rails_template.rb | |
| if yes? 'Deploy to herok?' | |
| gem 'rails_12factor', group: :production | |
| end | |
| gem 'dotenv' | |
| if yes? 'Use slim?' | |
| gem 'slim-rails' |
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 'objspace' | |
| require 'csv' | |
| require 'nkf' | |
| require 'tempfile' | |
| def test_a | |
| src_encoding = NKF.guess(File.read(ARGV[0], 1_048_576)) | |
| case src_encoding | |
| when Encoding::US_ASCII, Encoding::UTF_8 | |
| 'UTF-8' |
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 'benchmark' | |
| require 'mini_magick' | |
| require 'open3' | |
| n = 100 | |
| Benchmark.bm(22) do |x| | |
| x.report("mini_magic") do | |
| n.times do | |
| blob = File.open('sample.jpg') |
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
| 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 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
| # 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 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
| 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 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
| 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 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
| 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/' |
OlderNewer