首页 软件开发 代码片段 ruby ( Page 14 )

ruby 388

#Ruby
表格的读取

# from table to CSV require 'odbc' require 'dbi' filename = "./file.csv" writeFile = File.…

2015-06-30 390

#Ruby
科拉茨猜想(3N +1问题)

def collatz(n) print "#{n} " if n > 1 if n % 2 != 0 collatz(3*n + 1) else collatz(n/2) …

2015-06-30 278

#Ruby
Ruby 使用 WSDL 调用 Web服务

require 'soap/wsdlDriver' wsdl = 'http://yourserver.net/quotes.wsdl' driver = SOAP::WSDLDr…

2015-06-25 290

#Ruby
Ruby Using WIN32OLE with PowerPoint

require 'win32ole' powerobj = WIN32OLE.new("powerpoint.application")

2015-06-24 892

#Ruby
去除C语言注释

require 'strscan' lex = [/"[^\\"]*(?:\\.[^\\"]*)*"/m, # string /'[^\\']*(?:\\.[^\\']*)*'/m…

2015-06-23 139

#Ruby
小型文本编辑器

stop_words = %w{the by on for of are with just but and to the my I has some in} lines = Fi…

2015-06-22 890

#Ruby
Bcode的ruby实现

class Bencode def initialize @ret = "" end public def encode(x) @ret = "" encode_auto(x) r…

2015-06-18 420

#Ruby
Linux 带宽使用情况

# Script to display the transfer information of a given # interface. Relies on /proc/net/d…

2015-06-17 545

#Ruby
让 p 1.self 不报错

class Object def self self end end p 1.self p 'a'.self p true.self p self.self

2015-06-15 745

#Ruby
webrick , sinatra , rails , heel ,thin 提速补丁

def rsed_do(fn,s1,s2) size = s1.bytesize if File.exist?(fn) print "exist: #{fn}\n" #读写方式打开…

2015-06-15 679

#Ruby
Rails 实现邮件特快专递

require 'resolv' require 'net/smtp' from = "your-email@example.com" to = "another-email@ex…

2015-06-13 781
1 12 13 14 15 16 33