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

ruby 388

#Ruby
蒙娜丽莎的微笑 Ruby版

#!/usr/bin/env ruby require "chingu" include Gosu include Chingu class MonaLisa < Ching…

2015-04-30 449

#Ruby
ruby发送、接收server-ex2007邮件

#Ruby发送、接收server-ex2007邮件 require 'net/smtp' require 'net/pop' EXServer = 'server-ex2007.x…

2015-04-30 373

#Ruby
Ruby 使用 TkListbox

require 'tk' top = TkRoot.new {title "Label and Entry Widget"} list1 = TkListbox.new(top) …

2015-04-29 243

#Ruby
对每个model的field错误信息提取到div的方法

module ApplicationHelper def error_div(model, field, field_name) return unless model field…

2015-04-26 536

#Ruby
完美解决rails中国时区时间设置

config.active_record.default_timezone = :local config.time_zone = 'Beijing'

2015-04-25 305

#Ruby
Rails 的 Controller 调用其他路径的 View 模板

class HelloController < ApplicationController def there if Time.now.hour == 12 render(:…

2015-04-24 633

#Ruby
Ruby 冒泡排序

def bubbleSort(a) swapped = true while swapped == true i = 0 swapped = false while(i < …

2015-04-24 837

#Ruby
Ruby 使用 XPath 遍历 XML 文档

xml = %{ <aquarium> <fish color="blue" size="small" /> <fish color="orange"…

2015-04-23 210

#Ruby
纯Ruby实现的AES加解密算法

class Array def rot(offset=1) # rotate byte self[offset..-1]+self[0,offset] end def ^(othe…

2015-04-22 931

#Ruby
Ruby 调用远程对象

require 'drb' class Counter attr_reader:count def initialize @count = 0 end def increment …

2015-04-19 641

#Ruby
Rails 使用 save 方法创建新纪录

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

2015-04-14 471

#Ruby
Ruby 在 Windows 下播放声音

require "win32ole" sound = WIN32OLE.new("MCI.MMcontrol") wav = "c:\\windows\\media\\The Mi…

2015-04-13 327
1 17 18 19 20 21 33