Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Forked from 140bytes/LICENSE.txt
Last active June 20, 2022 21:38
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save plugnburn/6130197 to your computer and use it in GitHub Desktop.
Text ZALGifier

ZALGO

T̵̸̴̙͒̈̑ͅͅh̢̢̬̳̱͔͕͐̽ë̗͉̲̲ͫ̓̕͠ ̪̰̣̔̑͌̐̌͢C̪͎͎̜ͤ̂ͪ̀͢h̙̦̝̎͛̇ͬ͂ͬä̴̢̺̹̮̰́̏͘o͒̕͏ͨ̀̌̂̌͠s̜̪̣͕̠̓͊͐͡ ̛̜̤̪ͤ͊̌̄͊S̰̻̖͙ͪ̆̈́̐͝c̛͎̫͚̣̞̝ͧ̕r̸̟̙ͧ͛ͩ́ͫ͜i̬̻͖̅ͨ̏̀̚͘p̯̲̜ͨ͒̑̑̕̕ṫ͚̲̫̆̒ͣ͠ͅ.̱̻̲̀͂͏̠ͧͦ ͚̩͛͐̾̒̀͝ͅH̡͙̙̀ͬ̇̚̚͢E͙͙̦͙̱ͫ̇ͪ̈ ̣͚̗̱ͬͬ̐͂̃Ĉ̨̩̠̍̅́̍͡O̪̖ͤͬ̐̍ͮ̋ͨM̨͇̭̗̜̗͒͟͝E̸̤̗̱̘ͦ͛͢ͅS͚ͧ̎ͭͥ̈̂͢͡.̮͎͓̓̀ͤ̽͗̕.͇͛͋͏̬̘ͤ͌͛.̢̡̳̰͓͑̑̋͊

Usage

zalgo("Your text")

or you can specify the optional zalgifying density (default is 9, suitable for most cases):

zalgo("Your text",15)

Current implementation is just 129 ͔̭͇ͥ͌̓̍̉͠b̷̨͕̝̞̅̔̎̿y̢͖͉͊ͣͫ̓̌̕.̙͔̠̐ͮͤ̍̅͝.̙̺̺̦̺͍ͦ̊͘.̮̬̭̥ͣ̀ͫ͢͠ ͉ͧ̅̾ͬ͏̠̓͜Ò̶̞͖̳̗͔͙̔H̵͍̳̦͂̂̐͘̚ ̟̰̘̄ͥ̐̒͗ͅN̟͏̭͔̪͛ͪ̉͂O̗̹͒̀͛ͪ̅͘̕!̡̜͎̈́͆̐͒͂ͣ ͍̗̤̯̣ͮ̈́̔ͅH̶̨͈̳̎͋͗͂̎E̢̧̧̦̩͓͇ͣ͐ ̖̣̦͓͆̈́͜͢͜C̟̦͎̼ͩ̔͘͜͟Ö̭̜̰̇ͧ̈́̔͝M̠͛͛͆͊̒͌̍̋Ȇ̟̬̗̱ͮ̓̈́͘S̵̭̪̮̓ͩ̍́͢ ͉̯͇̦ͥ͗͊͛̈A͚͕̺̔̐̔͛̈́͜G̸̛̤̳̻ͫ̚͢͡Ą̣͚̱̺̎̄̌ͅÌ̛͍̯͛ͤ̊͂́N̨̨͍͇̋̓͐ͤ͟

function(z,a,l,g,o){for(l=z.length*(a=a||9),g=-1,o='';++g<l;o+=g%a?String.fromCharCode(768+Math.random()*111|0):z[g/a]);return o}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 plugnburn
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": "zalgo",
"description": "Zalgify your text!",
"keywords": [
"zalgo",
"string",
"masking",
"chaos",
"encoding"
]
}
@plugnburn
Copy link
Author

atk, its also OK but charAt must die. You can use just z[g/a].

@plugnburn
Copy link
Author

Btw, your code is not identical as it doesn't provide the default density. And emits some undefined value because of <=l, not <l.
So, the correct version would be:

function(z,a,l,g,o){for(l=z.length*(a=a||9),g=-1,o='';++g<l;o+=g%a?String.fromCharCode(768+Math.random()*111|0):z[g/a]);return o}

Anyway, thanks for the hint. Updated.

@atk
Copy link

atk commented Aug 8, 2013

.charAt is for IE<10 compatibility.

@plugnburn
Copy link
Author

I know what and whom is it for. My utilities are all ES5-oriented and I'm not going to explicitly favor these morons at the cost of simplicity.

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