class HelloController < ApplicationController def set_cookie cookies[:my_name] = "AAAA"…
#分两种情况 #第一种是奇数位字符串 def method str p str == str.reverse ? "Yes" : "No" end #另一种是偶数位字符串 def …
class String def - str self.gsub(str, "") end end puts "Hello" - "H"
TEST_FILE_NAME = '乘法口诀.txt' #创建文件 File.open(TEST_FILE_NAME, 'w+') do |file| for x in 1..9 …
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xh…
class HelloController < ApplicationController def there if Time.now.hour == 12 render(:…
drop database Contact; create database Contact; use Contact; CREATE TABLE Employee ( id in…
require 'fssm' FILE_PATH = '/home/yourpath/' def compile(path) system "coffee -c #{path}" …
def triangle(x,y,z) angleX=Math.acos((y**2+z**2-x**2)*3.14/(360*y*z)) #angleX is the angle…
#!/usr/bin/env ruby #encoding: UTF-8 # 抓取每一个站点的首页链接数量 # require 'rubygems' # 1.8.7 require…
require 'Tk' top = TkRoot.new{title "Radio Button"} radioVar=TkVariable.new r1 = TkRadioBu…
Rails 的 Controller 调用其他路径的 View 模板