Run 5 times, with one second delay between calls
t1 = new Timer(500, function(){
console.log(this.count);
if (this.count >= 5) {
this.stop();
}
});
| // Better function.bind() | |
| // Origin http://twitpic.com/1tbwip | |
| // Inspired by http://perfectionkills.com/semantic-constructors/ | |
| Function.prototype.bind = function bind(thisObject) { | |
| var func = this; | |
| var args = Array.prototype.slice.call(arguments, 1); | |
| function bound() { | |
| return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); | |
| } | |
| bound.toString = function toString() { |
| <script> | |
| KeyboardEvent.prototype.__defineGetter__('character', function(){ | |
| return (this.ctrlKey || this.altKey || this.metaKey || !this.charCode) | |
| ? "" | |
| : String.fromCharCode(this.charCode); | |
| }); | |
| onkeypress = function(e){ | |
| document.getElementById('char').innerHTML += e.character + ' ' | |
| } |
| function unicodeToActualCharacter(code) { | |
| // Convert unicode sequence to actual character | |
| // | |
| // unicodeToActualCharacter('U+005A') --> "Z" | |
| return eval('"'+ code.replace("U+", "\\u") +'"'); | |
| } |
| function chain(fn){ | |
| // Chain factory | |
| var list = [fn]; | |
| return function oneChain(fn){ | |
| if (arguments.length) { | |
| list.push(fn); | |
| return oneChain; | |
| } else { | |
| var result; | |
| while (list.length) { |
| function queue(){ | |
| function runQueue(){ | |
| var result = arguments; | |
| var args = runQueue.args; | |
| for (var i=0; i<args.length; i++) { | |
| result = [args[i].apply(this, result)]; | |
| } | |
| return result[0]; | |
| } | |
| runQueue.args = arguments; |
| google.ac | |
| google.ae | |
| google.af | |
| google.ag | |
| google.am | |
| google.com.ar | |
| google.as | |
| google.at | |
| google.com.au | |
| google.az |
via xrefresh#17
ruby ws_dir_watcher.rb ~/my_site| dog = 'Bob' | |
| class << dog | |
| def what | |
| self | |
| end | |
| end | |
| dog.what #'Bob' | |
| ''.what #NoMethodError |
8 spaces for the tab character is too many. I'd prefer 2.
Supported browsers: Firefox, Google Chrome, Opera, and Safari.
beforeafter