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

ruby 388

#Ruby
Ruby 获取 HTTP 回应的编码和内容

require 'net/http' response = Net::HTTP.get_response('www.oschina.net, '/code/list') respo…

2015-04-13 752

#Ruby
wxRuby编写的简单计算器

#===================================================== # █ wxRuby Calculator Sample Code …

2015-04-13 999

#Ruby
Ruby 使用 Net::HTTP 一例

require 'net/http' home = Net::HTTP.new("www.oschina.net", 80) response, text = home.get("…

2015-04-12 528

#Ruby
一键push 到 所有 git 仓库

#!/usr/bin/env ruby # -*- coding: utf-8 -*- def t s p s Thread.new { system s } end `git r…

2015-04-12 777

#Ruby
让windows的netstat -ano 显示IP所属地区区域和进程名

#! /usr/bin/env ruby # =kk= # sevkme@qq.com # coding: utf-8# # 需要 QQwry.dat 这个纯真IP库 requir…

2015-04-11 492

#Ruby
WEBrick 的基本例子

require 'webrick' server = WEBrick::GenericServer.new(:Port => 1234) trap("INT"){ serve…

2015-04-09 921

#Ruby
Ruby 使用 Hpricot 搜索 HTML 中的元素

require 'rubygems' require 'hpricot' require 'open-uri' doc = Hpricot(open('http://www.rub…

2015-04-08 267

#Ruby
简单的文本加密

require "jcode" $KCODE="u" #使用utf-8的字符集,解决中文会出现乱码的问题 TEST_OJ="C:/BJ.txt" puts "请输入文件的路径:" …

2015-04-06 867

#Ruby
利用Google API实现翻译功能

// Find quickly the translation of something without having to go to the browser // Exampl…

2015-04-05 828

#Ruby
Ruby 完整布局管理示例

require "tk" $top = { 'side' => 'top', 'padx'=>5, 'pady'=>5 } $left = { 'side' =&…

2015-04-04 235

#Ruby
Rails 一对多映射

drop database Contact; create database Contact; use Contact; CREATE TABLE Employee ( id in…

2015-03-30 480

#Ruby
让 screen -r 更方便

#!/usr/bin/env ruby # 自动查找所有 screen 并 -r , 参数是第几个screen . # 比如 scr.rb 0 或 scr.rb 1 , # 可以 …

2015-03-29 802
1 18 19 20 21 22 33