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

ruby 388

#Ruby
make doxygen comments in Obj-C/C/C++ files

#!/usr/bin/env ruby # # v2.0 # This script helps you make doxygen comments in Obj-C/C/C++ …

2014-12-22 747

#Ruby
Ruby 之 GServer 同时创建多个服务器实例

require 'gserver' class HelloServer < GServer def serve(io) io.puts("Say something to m…

2014-12-22 127

#Ruby
Ruby 构建一个简单的支持多线程的 Web 服务器

require 'thread' require 'socket' class RequestHandler def initialize(session) @session = …

2014-12-20 777

#Ruby
Ruby 使用 xmlparser 解析 XML 信息

require 'xmlparser' class XMLRetry<Exception; end class SampleParser<XMLParser priva…

2014-12-20 131

#Ruby
Ruby 使用 Net::Telnet 连接到 TCP 服务器

require 'net/telnet' server = Net::Telnet::new('Host' => '127.0.0.1', 'Port' => 1234…

2014-12-18 606

#Ruby
Ruby 构建一个最简单的 HTTP 服务器

require 'socket' server = TCPServer.new("0.0.0.0", 80) loop do socket = server.accept whil…

2014-12-16 752

#Ruby
Ruby 为 HTTPS 设置校验模式

require 'net/https' require 'net/http' uri = URI.parse("https://www.yourDomain.gov/") requ…

2014-12-15 774

#Ruby
单例模式

class SingleSimple def initialize @log=File.open("sy.txt","a+") end @@instance=SingleSimpl…

2014-12-14 647

#Ruby
ryby/tk 小时钟

#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'observer' require 'thread' require 't…

2014-12-14 813

#Ruby
Ruby 打开 Windows 对话框并获取返回值

require 'Win32API' title = "My Application" text = "Hello, world!" dialog = Win32API.new('…

2014-12-10 691

#Ruby
递归删除目录

# encoding: utf-8 def recursive_delete(dir) files = [] Dir.foreach(dir) do |fname| next if…

2014-12-09 406

#Ruby
快速迭代hash表

h = {'a'=>'aaa',2=>'bbb'} h.each do |a,b| puts a.to_s+"--"+b.to_s end

2014-12-09 427
1 27 28 29 30 31 33