Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Last active February 3, 2016 17:03
Show Gist options
  • Save brianloveswords/dd4628fbabb26923ea1d to your computer and use it in GitHub Desktop.
Save brianloveswords/dd4628fbabb26923ea1d to your computer and use it in GitHub Desktop.
// pre-compiled
function randomElement(array) {
var index = Math.random() * array.length | 0;
return array[index];
}
function printEmoji(emoji, num) {
if (num <= 0)
return;
process.stdout.write(randomElement(emoji));
return printEmoji(emoji, --num);
}
(function main() {
var emoji = ["❀", "πŸ’”", "β™₯", "πŸ’—", "πŸ’“", "πŸ’•", "πŸ’–", "πŸ’ž", "πŸ’˜", "πŸ’›", "πŸ’™", "πŸ’œ", "πŸ’š", "πŸ’",];
var numberOfElements = 140;
printEmoji(emoji, numberOfElements);
})();
/// <reference path="node.d.ts" />
function randomElement(array: Array<string>): string {
const index = Math.random() * array.length | 0;
return array[index];
}
function printEmoji(emoji: Array<string>, num: number) {
if (num <= 0) return;
process.stdout.write(randomElement(emoji));
return printEmoji(emoji, --num);
}
(function main() {
const emoji: Array<string> =
["❀","β™₯","πŸ’—","πŸ’“","πŸ’•","πŸ’–","πŸ’ž","πŸ’˜","πŸ’›","πŸ’™","πŸ’œ","πŸ’š","πŸ’",];
let numberOfElements: number = 140;
printEmoji(emoji, numberOfElements);
})();

On OS X,

$ node celebrate.js | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment