Created
June 29, 2012 07:03
-
-
Save matin0728/3016399 to your computer and use it in GitHub Desktop.
This file contains 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
goog.provide('ZhiHu.JavascriptPirate'); | |
goog.require("Programmer"); | |
/* | |
Abstract class. | |
*/ | |
ZhiHu.JavascriptPirate = function(macBookPro, extraLCD){ | |
this.myMacbook = macBookPro; | |
this.extraLCD = extraLCD; | |
}; | |
goog.inherits(ZhiHu.JavascriptPirate, Programmer); | |
ZhiHu.JavascriptPirate.prototype.workHard = function(){ | |
if(!this.isTired()){ | |
this.doWork_(); | |
} | |
}; | |
ZhiHu.JavascriptPirate.prototype.isTired = function(){ | |
console.log("WARNING: I'm fine."); | |
return false; | |
}; | |
ZhiHu.JavascriptPirate.prototype.isQualify = function(){ | |
if(this.lazy_ || this.notLoveJS){ | |
return false; | |
} | |
var items = [ | |
["isGeek", 5], | |
["familiarWithDebugTools", 10], | |
["familiarWithJQuery/Mootools/GoogleClosure/YUI", 20], | |
["PSToWebpage", 10], | |
["IE8/Chrome/FF/SafariCompatible", 10], | |
["familiarWithHtml5", 15], | |
["familiarWithPython/C/C++/Java/C#/PHP", 15], | |
["commonDesignPatterns", 10], | |
["expierenceWithGit/SVN", 5], | |
["expierenceWithLinux", 5], | |
["BeAggressiveness", 5], | |
]; | |
if(this.isSuperMan()){ | |
return true; | |
} | |
var score = 0; | |
goog.array.forEach(items, function(item){ | |
if(this.hasOwnProperty(item[0])){ | |
score += item[1]; | |
} | |
}, this); | |
return score > 70; | |
}; | |
!function(excellentProgrammer){ | |
setTimeout(function(excelentProgrammer){ | |
excelentProgrammer.workHard(); | |
}, 1000*60*60*24); | |
}(new ZhiHu.JavascriptPirate(new MacbookPro, new LCD()); |
s/expierence/experience/g ?
sob
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The last line should be
new MacbookPro()
missing parentheses