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 |
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
| # 一个简单的姓名拼音匹配 | |
| # | |
| # 姓名一般是由两三个汉字组成,选其顺序且连续的拼音缩略的组合就算匹配成功。 | |
| # | |
| 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
| 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
| binary_search.rbc |
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
| def nil.hello world | |
| world | |
| end | |
| def method_rescue o | |
| begin | |
| nil.send(:hello) | |
| rescue | |
| end | |
| 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
| File.read('number.txt').split("\n").select {|str| (str[4] == str[6]) && (str[8] == str[10]) }.reject {|str| str.match(/4/) }.map(&:strip) |
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
| xml.feed(:xmlns => "http://www.w3.org/2005/Atom") { |feed| | |
| feed.title("#{user.name}'s Private Notification Feed") | |
| feed.link(:href => "http://#{account.subdomain}.domain.com/feeds/#{user.email_alias}.xml", :rel => "self") | |
| feed.link(:href => "http://#{account.subdomain}.domain.com") | |
| } |
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
| production: | |
| listen: 0.0.0.0:9312 | |
| address: 0.0.0.0 # 对应的安装了searchd(sphinx)的mysql服务器ip | |
| port: 9312 # 对应的安装了searchd(sphinx)的mysql服务器端口 | |
| bin_path: '/usr/local/bin' | |
| searchd_file_path: '/data/sphinx/production' | |
| query_log_file: '/data/sphinx/log/searchd.query.log' | |
| searchd_log_file: '/data/sphinx/log/searchd.log' | |
| exceptions: '/data/sphinx/log//exception.log' | |
| enable_star: true # 支持通配符匹配 |
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
| # http://www.bjt.name/2011/06/beautiful-math-triangle-r/ | |
| proc do |line| | |
| (1..line).each do |num| | |
| puts "#{' '*(line - num)}#{('1'*num).to_i**2}" | |
| end | |
| end.call((ARGV[0] || 36).to_i) |
OlderNewer