摘要:class MyClass def sayHello return "hello from MyClass" end def sayGoodbye return "Goodbye from MyClass" endendclass MyOtherClass < MyClass def sayHello return "Hello from MyOtherClass" end def sayGoodbye return super << "and also from MyOtherClass...
阅读全文
摘要:create()) { $result =$Form->add(); if($result) { $this->success('操作成功!'); }else{ $this->error('写入错误!'); } }else{ $this->error($Form->getError()); } } public function read($id=5){ $Form=M("...
阅读全文
摘要:_color; case 'setColor': $this->_color=$first; return $this; case 'getModel': return $this->_model; case 'setModel': $this->_model=$first; return $this; ...
阅读全文
摘要:var http=require("http");var url=require("url");var pages=[ {id:"1",route:"",output:"Woohoo!"}, {id:"2",route:"about",output:"A simple routing width node example"}, {id:"3",route:"another page",output
阅读全文
摘要:Follow Mouse utils.js 文件https://gist.github.com/King-fly/6034511/raw/2e28359afdfb45800948f0e6bd31aa958ba7f5cb/html5+utilsball.js 文件https://gist.github.com/King-fly/6034525/raw/4664959f6e33196b9b4520136cc67573e07c8282/ball.js
阅读全文
摘要:Follow Mouse function Ship(){ this.x=0; this.y=0; this.width=25; this.height=20; this.rotation=0; this.showFlame=false;}Ship.prototype.draw=function(context){ context.save(); context.translate(this.x,this.y); context.rotate(this.rotation); ...
阅读全文
摘要:function Arrow(){ this.x=0; this.y=0; this.color='#ffff00'; this.rotation=0;}Arrow.prototype.draw=function(context){ context.save(); context.translate(this.x,this.y); context.rotate(this.rotation); context.lineWidth=2; context.fillStyle=this.col...
阅读全文
摘要:var whenReady=(function(){ var funcs=[]; var ready=false; function handler(e){ if (ready) { return; } if (e.type==="readystatechange" && document.readyState!=="complete") { return; } for(var i=0;i<funcs.length;i++){ funcs[i...
阅读全文
摘要:var Klass=function(Parent,props){ var Child,F,i; Child=function(){ if(Child.uber && Child.uber.hasOwnProperty("__construct")){ Child.uber.__construct.apply(this,arguments); } if(Child.prototype.hasOwnProperty("__co...
阅读全文
摘要:require 'mysql'con=Mysql.new('localhost','root','root','test')con.query('set names utf8')rs=con.query('select * from demotb')p rs.num_fields()p '---------------------'num=rs.num_rows()for i in 0..num-1 rs.data_seek(i) a=rs.fetch_row() p
阅读全文
摘要:this is a demo. this is a demo. this is a demo. 结合之前看的一些js书籍以及blog和一些js框架源码 最近总结了一下,花点时间完善了一下之前写的js小库,继续完善之中
阅读全文
摘要:path="test.txt"port=open(path)begin port.each_line{|line| p line.to_s }ensure port.closeendSTDOUT << "i love you \n"port=open('test.txt')s=port.statp s.ftypep s.devp s.inop s.modep s.nlinkbegin a=port.readlines a=port.each{|e| p e} ensure port.close end
阅读全文
摘要:i=1Thread.start{ while true print "Thread 1 \n" i+=1 if i==5 then Thread.kill Thread.current end end}j=1while true print "Thread 2 \n" j+=1 if j==4 then Thread.exit endend
阅读全文
摘要:1 局部变量和方法参数以小写字母开头2 方法名字以小写字母开头3 全局变量以$开头4 实例变量以@开头5 类变量以@@开头6 常量以大写字母开头7 类和模块名以大写字母开头
阅读全文
摘要:module My NA="China" attr:name attr:age def set_name(name) @name=name end def get_name return @name end def set_age(age) @age=age endendclass Test include Myendt=Test.newt.set_name("history")p t.get_name
阅读全文
摘要:module My NA="China" def My.set_name(name) @name=name end def My.get_name return @name end def My.set_age(age) @age=age endendMy.set_name("wanwgenfei")p My.get_namep My::NAmodule Your Na="AC" attr:name def Your.set_name(name) My.set_name(name...
阅读全文
摘要:class My def initialize(name,age) @name=name @age=age end def sayName puts @name end def sayAge puts @age end def repeat(num) while num>0 yield num-=1 end endendm=My.new("wanan", 23)m.repeat(3){puts "...
阅读全文
摘要:class Man def initialize(name,age) @name=name @age=age end def sayName puts @name end def sayAge puts @age endendm=Man.new('tianen',213)m.sayAgem.sayNameclass Man def initialize(name,age) @name=name @age=age end def sayName ...
阅读全文