Skip to content

Instantly share code, notes, and snippets.

@bluesmoon
Forked from aemkei/LICENSE.txt
Created October 18, 2011 16:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluesmoon/1295943 to your computer and use it in GitHub Desktop.
Save bluesmoon/1295943 to your computer and use it in GitHub Desktop.
JS ASCII Logo - 140byt.es

JS ASCII Logo - 140byt.es

My second attempt to draw the JS Community logo in less than 140 bytes.

This time parsing binary bitmap data in pure JavaScript. See the example.

Update: The source is now included in the official logo.js repository.

Example output

    ████████████████████████
    ████████████████████████
    ████████████████████████
    ████████████████████████
    ████████████████████████
    ██████████  ████    ████
    ██████████  ██  ████████
    ██████████  ████    ████
    ██████████  ████████  ██
    ██████████  ██  ████  ██
    ██████    ██████    ████
    ████████████████████████

For more information

See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.

To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to the wiki.

140byt.es is brought to you by Jed Schmidt, with help from Alex Kloss. It was inspired by work from Thomas Fuchs and Dustin Diaz.

function( // all arguments are placeholder
a, // index
b, // string to return
c // binary string
){
for (
a = 12; // read 12 lines
a--;
c = [c] + (
4095 ^ [ // combine with 2^12
// reversed bitmap array:
, // 111111111111
396, // 111001110011
82, // 111110101101
66, // 111110111101
76, // 111110110011
80, // 111110101111
76 // 111110110011
][ a ]
).toString(2) // convert decimals to binary presentation
+ 2 // add "2" to end of line
);
for (a in c) // read binary string
b = [b] + " ■\n"[ // charater map 0 > space, 1 > block, 2 > new line
c[ a ] // get "0", "1" or "2" from string
];
return b // return the logo
}
function(a,b,c){for(a=12;a--;c=[c]+(4095^[,396,82,66,76,80,76][a]).toString(2)+2);for(a in c)b=[b]+" ■\n"[c[a]];return b}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "jsLogo",
"description": "Renders the JS community logo in ASCII art",
"keywords": [
"ascii",
"binary",
"js",
"logo"
]
}
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>JS ASCII Logo - 140Byt.es</title>
<style>
#logo {
font-family: "Courier New", monospace;
color: #F0DB4F;
background: #323330;
display: inline-block;
white-space: pre;
line-height: 33px;
font-size: 55px;
}
</style>
</head>
<body>
<div id="logo"></div>
<script>
var logo = function(a,b,c){for(a=12;a--;c=[c]+(4095^[,396,82,66,76,80,76][a]).toString(2)+2);for(a in c)b=[b]+" ■\n"[c[a]];return b}
document.getElementById( "logo" ).innerHTML = logo()
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment