Skip to content

Instantly share code, notes, and snippets.

@matin0728
Created June 29, 2012 07:03
Show Gist options
  • Save matin0728/3016399 to your computer and use it in GitHub Desktop.
Save matin0728/3016399 to your computer and use it in GitHub Desktop.
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());
@xieranmaya
Copy link

The last line should be
new MacbookPro()
missing parentheses

@zzn2
Copy link

zzn2 commented Jan 18, 2013

s/expierence/experience/g ?

@lichenhao
Copy link

sob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment