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

ruby 388

#Ruby
Ruby 调用 XML RPC 服务

def lookup_upc(upc) server = XMLRPC::Client.new2('http://www.upcdatabase.com/rpc') begin r…

2015-02-19 852

#Ruby
Rails 的 SQL 映射之 order by 查询

Account.find :all, :order => "created_on DESC, last_name, first_name"

2015-02-18 333

#Ruby
Ruby 打开 IE 浏览器并访问首页

require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.…

2015-02-18 778

#Ruby
Ruby 从 TCP 服务器上接收数据

require 'socket' host = "localhost" port = 12345 TCPSocket.open(host, port) do |s| # Use b…

2015-02-18 864

#Ruby
5行代码实简单的web应用程序

require 'rubygems' require 'sinatra' get '/' do 'Hello World' end

2015-02-16 542

#Ruby
ruby流程控制语句

#coding=utf-8 =begin 通过这个例子进一步学习ruby中的数据类型 以及循环分支等控制语句的用法 =end class Example02 #输入数据判断数据类型…

2015-02-15 537

#Ruby
使用Ruby和Nokogiri的网页爬虫例子,导出RSS种子

# encoding: utf-8 require 'thread' require 'nokogiri' require 'open-uri' require 'rss/make…

2015-02-14 495

#Ruby
Ruby 发起 HTTPS 请求

require 'net/https' # => true require 'net/http' uri = URI.parse("https://www.yourDomai…

2015-02-12 998

#Ruby
Ruby 直接对内存中的字符串进行压缩和解压

require 'zlib' deflated = Zlib::Deflate.deflate("this is a test.") puts deflated puts Zlib…

2015-02-12 707

#Ruby
ActiveRecord中指定Entity的默认排序方式

class Entity < ActiveRecord::Base default_scope :order => 'created_at DESC' end

2015-02-11 353

#Ruby
Rails 指定 SMTP 邮件服务器端口

require 'net/smtp' message = <<MESSAGE_END From: Private Person <me@privacy.net&g…

2015-02-10 929

#Ruby
ruby实现aes

#gem install fast-aes require 'rubygems' require 'fast-aes' # key can be 128, 192, or 256 …

2015-02-09 619
1 22 23 24 25 26 33