12 2012 档案
摘要:只需要在你的HTML里加入如下的代码,就可以体验CoffeeScript了
阅读全文
摘要:这个功能要模拟Groovy中Expando和Javascript中的{},这里要用到ruby自带的osstruct库#!C:/Ruby192/bin/ruby.exerequire 'ostruct'def mytest puts "a method"end o = OpenStruct.newo.method1 = mytesto.prop1 = "a property"puts o.method1puts o.prop1
阅读全文
摘要:https://github.com/pivotal/jasmine-gem可参考上面的链接在Ruby中使用Jasmine,因为就是独立开发一个JavaScript的项目,所以我会使用 `jasmine init`来初始化一个项目。但当运行 `rake jasmine`的时候发现会错误产生, Google 了一下,找到一文章,试验过后发现可用。要修改对应的rakefile,多引入require 'yaml'sample case:begin require 'jasmine' require 'yaml' //自动生成的代码里是没这一行的 loa
阅读全文
摘要:http://devnet.jetbrains.net/thread/435906?tstart=1 上面是论坛的一帖,很好的解释了如何使用。把例子下下来看看就很清楚了。
阅读全文
摘要:The rule is: If you add a number and a string, the result will be a string!Example x=5+5;y="5"+5;z="Hello"+5;The result of x,y, and z will be:1055Hello5
阅读全文
摘要:今天注意到JavaScript里的一个特性:一个变量被重新声明后,其之前的赋值还是存在的。var test ="test";console.debug(test) ;//output: testvar test;console.debug(test);// also output: test
阅读全文
摘要:http://stackoverflow.com/questions/2266789/is-there-an-equivalent-of-the-nosuchmethod-feature-for-properties-or-a-way不过注意到不是所有的浏览器里都支持的。https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/noSuchMethod上面说到的可以再Firefox里跑通,但到了Chrome中就不行了。
阅读全文
摘要:http://confluence.jetbrains.net/display/WI/Getting+Started+with+JsTestDriver+IntelliJ+plugin
阅读全文
摘要:Link:http://msdn.microsoft.com/en-us/magazine/gg655487.aspx
阅读全文
摘要:https://github.com/pivotal/jasmine/pull/181
阅读全文
摘要:The operator in can be used to test whether an object has a certain property.var person = {}person.name = "buhaiqing"console.debug( "name" in person) // return : true
阅读全文
摘要:Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language.Link: http://code.google.com/p/spock/sample Maven pom.xml:http://code.google.com/p/spock/wiki/HelloSpockPom可以使用when/th
阅读全文
摘要:希望是能在使用Singleton模式的时候既能考虑到性能,又能延迟加载。publicclassStaticSingleton{privateStaticSingleton(){System.out.println("StaticSingletoniscreate");}privatestaticclassSingletonHolder{privatestaticStaticSingletoninstance=newStaticSingleton();}publicstaticStaticSingletongetInstance(){returnSingletonHolder
阅读全文

浙公网安备 33010602011771号