Last active
May 20, 2020 05:22
-
-
Save hperrin/d86131552154ab0bb4ba2c85edad93d7 to your computer and use it in GitHub Desktop.
Revisions
-
hperrin revised this gist
May 20, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ function verses(bottles) { const count = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; return [...new Array(bottles + 1)].map((v, i) => bottles - i).map(b => [ `${count(b, true)} of beer on the wall, ${count(b)} of beer.`, b > 0 ? `Take one down and pass it around, ${count(b - 1)} of beer on the wall.` : `Go to the store and buy some more, ${count(bottles)} of beer on the wall.` ]); } const container = document.createElement('pre'); -
hperrin revised this gist
May 20, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ function verses(bottles) { const count = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; return [...new Array(bottles + 1)].map((v, i) => bottles - i).map(b => ([ `${count(b, true)} of beer on the wall, ${count(b)} of beer.`, b > 0 ? `Take one down and pass it around, ${count(b - 1)} of beer on the wall.` : `Go to the store and buy some more, ${count(bottles)} of beer on the wall.` -
hperrin revised this gist
May 20, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ function verses(bottles) { const count = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; return [...new Array(bottles + 1)].map((v, i) => bottles - i).map(b => ([ `${count(b, true)} of beer on the wall, ${count(b)} of beer!`, b > 0 ? `Take one down and pass it around, ${count(b - 1)} of beer on the wall.` : `Go to the store and buy some more, ${count(bottles)} of beer on the wall.` ])); } -
hperrin revised this gist
May 20, 2020 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ function verses(bottles) { const bottleString = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; return [...new Array(bottles + 1)].map((v, i) => bottles - i).map(b => ([ `${bottleString(b, true)} of beer on the wall, ${bottleString(b)} of beer!`, b > 0 ? `Take one down and pass it around, ${bottleString(b - 1)} of beer on the wall.` : `Go to the store and buy some more, ${bottleString(bottles)} of beer on the wall.` ])); } const container = document.createElement('pre'); container.innerText = verses(99).map(verse => verse.join('\n')).join('\n\n'); document.body.appendChild(container); -
hperrin revised this gist
May 20, 2020 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ function sing(bottles) { const count = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; [...new Array(bottles + 1)].map((v, i) => bottles - i).forEach(b => { console.log(`${count(b, true)} of beer on the wall, ${count(b)} of beer!`); if (b > 0) { console.log(`Take one down and pass it around, ${count(b - 1)} of beer on the wall.`); } else { console.log(`Go to the store and buy some more, ${count(bottles)} of beer on the wall.`); } }); } -
hperrin revised this gist
May 20, 2020 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ function sing(bottles) { const bottleString = (b, cap) => `${b || `${cap ? 'N' : 'n'}o more`} bottle${b == 1 ? '' : 's'}`; [...new Array(bottles + 1)].map((v, i) => bottles - i).forEach(b => { console.log(`${bottleString(b, true)} of beer on the wall, ${bottleString(b)} of beer!`); if (b > 0) { console.log(`Take one down and pass it around, ${bottleString(b - 1)} of beer on the wall.`); } else { console.log(`Go to the store and buy some more, ${bottleString(bottles)} of beer on the wall.`) } }); } -
hperrin revised this gist
May 20, 2020 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ function sing(bottles) { [...new Array(bottles + 1)].map((v, i) => bottles - i).forEach(b => { console.log(`${b} bottle${b == 1 ? '' : 's'} of beer on the wall, ${b} bottle${b == 1 ? '' : 's'} of beer!`); if (b > 0) { console.log(`Take one down and pass it around, ${b - 1} bottle${b - 1 == 1 ? '' : 's'} of beer on the wall.`); } else { console.log(`Go to the store and buy some more, ${bottles} bottle${bottles == 1 ? '' : 's'} of beer on the wall.`) } }); } -
hperrin revised this gist
May 20, 2020 . No changes.There are no files selected for viewing
-
hperrin created this gist
May 20, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function sing(bottles) { [...new Array(bottles + 1)].map((v, i) => bottles - i).forEach(b => { console.log(`${b} bottle${b == 1 ? '' : 's'} of beer on the wall, ${b} bottle${b == 1 ? '' : 's'} of beer!`); if (b > 0) { console.log(`Take one down and pass it around, ${b - 1} bottle${b - 1 == 1 ? '' : 's'} of beer on the wall.`); } else { console.log(`Go to the store and buy some more, ${bottles} bottle${bottles == 1 ? '' : 's'} of beer on the wall.`) } }); } sing(99);