This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
module.exports = { | |
seleniumHost: 'http://localhost:4444/wd/hub', | |
browsers: ['firefox'], | |
envHosts: { | |
prodtest: 'http://prodtest.aami.com.au', | |
prod: 'http://www.aami.com.au' | |
}, | |
paths: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [] | |
class << a | |
Array.instance_methods(false).each do |meth| | |
old = instance_method(meth) | |
define_method(meth) do |*args, &block| | |
old_size = size | |
old.bind(self).call(*args, &block) | |
size_changed(size) if old_size != size | |
end if meth != :size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exec} = require 'child_process' | |
run = (command, callback) -> | |
exec command, (err, stdout, stderr) -> | |
console.warn stderr if stderr | |
callback?() unless err | |
build = (callback) -> | |
run 'coffee -co lib src', callback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wikipedia explanation: http://zh.wikipedia.org/wiki/Git#.E5.91.BD.E5.90.8D.E6.9D.A5.E6.BA.90 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var outer2 = document.getElementById('outer2'); | |
var inner2 = document.getElementById('inner2'); | |
var stopChecked = document.getElementById('stopChecked'); | |
outer2.addEventListener('click', function(evt) { | |
alert('outer click 1.'); | |
}, false); | |
inner2.addEventListener('click', function(evt) { | |
alert('inner click 1.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function once(elem, eventType, handler){ | |
elem.addEventListener(eventType, function(evt){ | |
handler.call(elem, evt); | |
elem.removeEventListener(eventType, arguments.callee/*, false */); | |
}, false) | |
} | |
once(document.getElementById('onceButton'), 'click', function(evt){ | |
alert('just show once!'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var outer = document.getElementById('outer'); | |
var inner = document.getElementById('inner'); | |
outer.addEventListener('click', function(evt){ | |
console.log(evt.target); | |
alert(0); | |
}, false); | |
inner.addEventListener('click', function(evt){ | |
console.log(evt.currentTarget); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['./lib/Mr.Async', './lib/Recoder/main'], function(Mr, interpreter){ | |
function getListData(url, callback){ | |
$.get(url, callback, 'json'); | |
} | |
function getSideBarData(url, data, callback){ | |
$.get(url, data, callback, 'json'); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['./lib/Mr.Async', './lib/Recoder/main'], function(Mr, interpreter){ | |
function asyncUpload(image){ | |
var dfd = Mr.Deferred(); | |
ajaxPost(image, function(ret){ | |
if(ret.status == 200){ | |
dfd.resolve(); | |
} | |
}); | |
return dfd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
why is it not 100% perfect? | |
- because if you wanna override the parent's method to get the private variable and use | |
my way to extend, you can not get the right value. in this code, a example can be found | |
to demonstrate the right way to use extend method, in this example, is you change the 'title' | |
variable like this way 'var title' not 'this.title', finally you just get the undefined value | |
after invoking the getTitle on Child class instance. | |
- any question, contact me through http://sheldonw.sinaapp.com | |
*/ |