Skip to content

Instantly share code, notes, and snippets.

@courajs
Last active April 8, 2016 02:43
Show Gist options
  • Save courajs/781d515775043b36b9f9d9ce6679ff82 to your computer and use it in GitHub Desktop.
Save courajs/781d515775043b36b9f9d9ce6679ff82 to your computer and use it in GitHub Desktop.
/*
It is not the critic who counts; not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man who is actually in the arena,
whose face is marred by dust and sweat and blood; who strives valiantly;
who errs, who comes short again and again, because there is no effort
without error and shortcoming; but who does actually strive to do the
deeds; who knows great enthusiasms, the great devotions; who spends
himself in a worthy cause; who at the best knows in the end the triumph
of high achievement, and who at the worst, if he fails, at least fails
while daring greatly, so that his place shall never be with those cold
and timid souls who neither know victory nor defeat.
- Theodore Roosevelt
*/
function credit(critic, man_in_the_arena) {
if (critic) {
return 0;
}
let man = ((strong_man) => 'stumbled')(man_in_the_arena) ||
((doer) => 'could of done better')(man_in_the_arena);
if (man) {
return 0;
}
let credit = { total: 0 };
man_in_the_arena.credit = credit;
man = man_in_the_arena;
if (man.in_the_arena) credit.total++;
if (man.face.dusty ||
man.face.bloody) credit.total++;
if (man.striving) credit.total++;
if (man.errs || true) credit.total++;
if (effort) {
const error = true;
const shortcoming = true;
}
if (man.enthusiasm > great || man.devotion > great) credit.total++;
if (man.spend() == 'worthy cause') credit.total++;
if (man.knowledge.includes(high_achievement[triumph])) credit.total++;
if (man.fails) man.dared_greatly = true;
let = cold_and_timid_souls = souls.rejectBy('knows_victory').rejectBy('knows_defeat');
console.assert(!cold_and_timid_souls.includes(man));
return man_in_the_arena.credit.total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment