Created
October 14, 2011 15:03
-
-
Save cowboy/1287364 to your computer and use it in GitHub Desktop.
Generate JS Logo "ascii" version. See https://github.com/voodootikigod/logo.js/blob/master/js.ascii
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 characters
| [ | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| "", | |
| " ```````` `.::::-.", | |
| " MMMMMMM+ /ymMMMMMMMMMms:", | |
| " MMMMMMM+ +NMMMMMMMMMMMMMMMd:", | |
| " MMMMMMM+ sMMMMMMMMNNNMMMMMMMN:", | |
| " MMMMMMM+ :MMMMMMMo` .oNMNy/`", | |
| " MMMMMMM+ oMMMMMMd .:", | |
| " MMMMMMM+ /MMMMMMMo`", | |
| " MMMMMMM+ dMMMMMMMMho:`", | |
| " MMMMMMM+ `hMMMMMMMMMMMmy/.", | |
| " MMMMMMM+ :hMMMMMMMMMMMMMmo`", | |
| " MMMMMMM+ `/ymMMMMMMMMMMMMs`", | |
| " MMMMMMM+ `:ohNMMMMMMMMd`", | |
| " MMMMMMM+ :yMMMMMMMs", | |
| " . MMMMMMM/ `// yMMMMMMd", | |
| " `/yNM+ :MMMMMMM- .+dMMMh- `dMMMMMMh", | |
| "-dMMMMMMmo//+yMMMMMMMd :MMMMMMMMmy+///oyNMMMMMMM:", | |
| " oMMMMMMMMMMMMMMMMMMm. .hMMMMMMMMMMMMMMMMMMMMN/", | |
| " .sNMMMMMMMMMMMMMNo` -sNMMMMMMMMMMMMMMMNo`", | |
| " :oydmNNNmdyo- ./shdmNNNmdhs+-", | |
| "", | |
| "" | |
| ].join("\n").replace(/([\s\S])\1+/g, function(str, char) { | |
| return str.length + char; | |
| }).replace(/\n/g, '\\n'); |
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 characters
| // Unminifed: | |
| ("17\n15 8`12 `.4:-.\n15 7M+9 /ym9Mms:\n15 7M+7 +N15Md:\n15 7M+6 s8M3N7MN:\n" + | |
| "15 7M+5 :7Mo`3 .oNMNy/`\n15 7M+5 o6Md7 .:\n15 7M+5 /7Mo`\n15 7M+6 d8Mho:`\n" + | |
| "15 7M+6 `h11Mmy/.\n15 7M+8 :h13Mmo`\n15 7M+10 `/ym12Ms`\n15 7M+14 `:ohN8Md`" + | |
| "\n15 7M+19 :y7Ms\n6 .8 7M/7 `2/11 y6Md\n2 `/yNM+6 :7M-4 .+d3Mh-8 `d6Mh\n-d" + | |
| "6Mmo2/+y7Md4 :8Mmy+3/oyN7M:\n o18Mm.5 .h20MN/\n2 .sN13MNo`8 -sN15MNo`\n5 :o" + | |
| "ydm3Nmdyo-14 ./shdm3Nmdhs+-2\n").replace(/(\d+)([\s\S])/g, function(_, n, s) { | |
| return Array(+n + 1).join(s); | |
| }) |
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 characters
| "17\n15 8`12 `.4:-.\n15 7M+9 /ym9Mms:\n15 7M+7 +N15Md:\n15 7M+6 s8M3N7MN:\n15 7M+5 :7Mo`3 .oNMNy/`\n15 7M+5 o6Md7 .:\n15 7M+5 /7Mo`\n15 7M+6 d8Mho:`\n15 7M+6 `h11Mmy/.\n15 7M+8 :h13Mmo`\n15 7M+10 `/ym12Ms`\n15 7M+14 `:ohN8Md`\n15 7M+19 :y7Ms\n6 .8 7M/7 `2/11 y6Md\n2 `/yNM+6 :7M-4 .+d3Mh-8 `d6Mh\n-d6Mmo2/+y7Md4 :8Mmy+3/oyN7M:\n o18Mm.5 .h20MN/\n2 .sN13MNo`8 -sN15MNo`\n5 :oydm3Nmdyo-14 ./shdm3Nmdhs+-3\n".replace(/(\d+)([\s\S])/g,function(_,n,s){return Array(+n+1).join(s)}); |
Author
Awesome.
If IE < 9 support is not an issue, you could save some bytes by using [^] instead of [\s\S].
Performance test case: http://jsperf.com/match-any-char-regex
Author
Is [^] matching all characters a bug?
It’s a feature!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you totally wasted one byte there:
+n+1can be reduced to-~n.