Skip to content

Instantly share code, notes, and snippets.

@dk5ax
Last active January 4, 2024 13:29
Show Gist options
  • Save dk5ax/f11a6a8a819fee04e0a2b31aba0cdc8b to your computer and use it in GitHub Desktop.
Save dk5ax/f11a6a8a819fee04e0a2b31aba0cdc8b to your computer and use it in GitHub Desktop.
Code100 HNY 2024 edition
// Sample solution for the following Code100 task:
// https://gist.github.com/codepo8/0c671bfebd4d3ab38e222c5fc247d819?utm_medium=email&_hsmi=288717159&utm_content=288717159&utm_source=hs_email
const input = [
0,0,0,121,231,143,195,118,216,195,54,223,195,182,216,121,231,
143,0,0,0,3,15,30,97,155,183,49,153,179,1,157,187,3,207,30,0,0,0
];
const toBin = value => (value >>> 0).toString(2).padStart(8, '0').split('').map(c => (c === '1') ? '😄' : '🍾').join('');
let line = '';
input.forEach((v,i) => {
line += toBin(v);
if (i % 3 == 2) {
console.log(line);
line = '';
}
});
@codepo8
Copy link

codepo8 commented Jan 4, 2024

Nice shifting :)

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