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
Makefile | |
*bundle | |
*o |
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 'chinese_pinyin' | |
@name = "成吉思汗" | |
pinyins = Pinyin.t(@name).split | |
# 把姓名生成对应的拼音数组 | |
array = [] |
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
# 把部分latin1编码的mysql表转化为UTF8编码 | |
ActiveRecord::Base.connection.tables.select do |t| | |
ActiveRecord::Base.connection.execute("show create table #{t}").to_a[0][1].match(/CHARSET=latin1/) | |
end.each do |t| | |
ActiveRecord::Base.connection.execute("alter table #{t} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;") | |
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
rvm install ree --with-iconv-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-zlib-dir=/usr --with-openssl-dir=/usr/local |
NewerOlder