Skip to content

Instantly share code, notes, and snippets.

@plugnburn

plugnburn/LICENSE.txt

Forked from 140bytes/LICENSE.txt
Last active Dec 20, 2015
Embed
What would you like to do?
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"
]
}
@atk

This comment has been minimized.

Copy link

@atk atk commented Aug 5, 2013

How about a non-array approach?

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

This comment has been minimized.

Copy link
Owner Author

@plugnburn plugnburn commented Aug 6, 2013

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

@plugnburn

This comment has been minimized.

Copy link
Owner Author

@plugnburn plugnburn commented Aug 6, 2013

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

This comment has been minimized.

Copy link

@atk atk commented Aug 8, 2013

.charAt is for IE<10 compatibility.

@plugnburn

This comment has been minimized.

Copy link
Owner Author

@plugnburn plugnburn commented Aug 8, 2013

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