Created
November 4, 2017 10:09
-
-
Save stephancom/09c124cd4eb27dd32e527a1c5ab446f3 to your computer and use it in GitHub Desktop.
z̴̧̢̳͇̣̰͍͉̠͎̤͚̭͓̮̖̦͕̯̰̦̠̼̩̀̐͛̎͋̎ͩ̂͛ͣ̂ͬͬ̕͘ą̯͎̜͇͚̣̖̖̬͚͉̳̗̺̥̒ͨ̈ͥͥ̿̓̀ͣ̀̇͢͢͝͞ͅl̶̖̞͖̪̝̬͇̗̝̠̟̖͇̪͇̥̠̫̺̪̮̠̪̩͍̠̯̙ͮͩ͌̄ͪͩ̅ͭ̆ͅg̡̩͓̰̞̬̘̥͇̻̖̥̻̖̼̠͉͇͙̘̝͕̮͇͉̪̟̩̻̩̤̍͗ͣ͊͋̃ͣ̌̄ͣ͑̋̂͐͛̐̂ͅͅǫ̭̠̰͔̯̝̹͓̲͖͇̺̳͍͉̯̗̘̱̣̱̼̟̰̝̠̬͉ͭ̊̈̇ͥ̇̾͋͒̌ͫ̊̉̑̓ͣ̑̅̀-̢̼̫̠̫͕̦͉̺̌͛̄ͯ̋̍͋ͬ̀̕͘v̢̰̠̱̠̖̲͔̗̠͍͙͉̯̘̲̦̝̣̩͚̳̼͈ͦ̑̈̄̈̑ͣ͟͜ụ̣̙͉̩͔̙̪̘̰͇͕̭͈͎͇̦͓͚̹͑̊̋̅͟͢͠͡e̴̜̙͈͖̯̲̪͙̼͍̰̯̗͆͐̾͊̏ͣ͊ͦ͒
This file contains 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
// _ | |
// | | | |
// ______ _| | __ _ ___ ________ ___ _ ___ | |
// |_ / _` | |/ _` |/ _ \______\ \ / / | | |/ _ \ | |
// / / (_| | | (_| | (_) | \ V /| |_| | __/ | |
// /___\__,_|_|\__, |\___/ \_/ \__,_|\___| | |
// __/ | | |
// |___/ by stephan@stephan.com | |
// | |
// a vue filter for zalgo text | |
// requires lodash | |
module.exports = { | |
install: (Vue, options) => { | |
Vue.filter('zalgo', (string, { size = 'maxi', up = true, mid = true, down = true } = {}) => { | |
if (size !== 'maxi' && size !== 'mini') { size = 'midi'; } | |
const diacritics = { | |
up: [ | |
'̍', '̎', '̄', '̅', '̿', '̑', '̆', '̐', '͒', '͗', '͑', '̇', '̈', '̊', | |
'͂', '̓', '̈', '͊', '͋', '͌', '̃', '̂', '̌', '͐', '̀', '́', '̋', '̏', | |
'̒', '̓', '̔', '̽', '̉', 'ͣ', 'ͤ', 'ͥ', 'ͦ', 'ͧ', 'ͨ', 'ͩ', 'ͪ', 'ͫ', | |
'ͬ', 'ͭ', 'ͮ', 'ͯ', '̾', '͛', '͆', '̚' | |
], | |
mid: [ | |
'̕', '̛', '̀', '́', '͘', '̡', '̢', '̧', '̨', '̴', '̵', '̶', '͜', '͝', | |
'͞', '͟', '͠', '͢', '̸', '̷', '͡' | |
], | |
down: [ | |
'̖', '̗', '̘', '̙', '̜', '̝', '̞', '̟', '̠', '̤', '̥', '̦', '̩', '̪', | |
'̫', '̬', '̭', '̮', '̯', '̰', '̱', '̲', '̳', '̹', '̺', '̻', '̼', 'ͅ', | |
'͇', '͈', '͉', '͍', '͎', '͓', '͔', '͕', '͖', '͙', '͚', '̣' | |
] | |
}; | |
const countFuncs = { | |
mini: { | |
up: () => { return _.random(8); }, | |
mid: () => { return _.random(2); }, | |
down: () => { return _.random(8); } | |
}, | |
midi: { | |
up: () => { return _.random(12); }, | |
mid: () => { return _.random(3); }, | |
down: () => { return _.random(12); } | |
}, | |
maxi: { | |
up: () => { return _.random(16) + 3; }, | |
mid: () => { return _.random(4) + 1; }, | |
down: () => { return _.random(32) + 3; } | |
} | |
}; | |
function randCounts () { | |
var value = {}; | |
if (up) { value.up = countFuncs[size].up(); } | |
if (mid) { value.mid = countFuncs[size].mid(); } | |
if (down) { value.down = countFuncs[size].down(); } | |
return value; | |
} | |
var heComes = ''; | |
_.each(string, (char) => { | |
heComes += char; | |
if (char !== ' ') { | |
var counts = randCounts(); | |
_.each(counts, (count, dir) => { | |
_.times(count, (i) => { | |
heComes += _.sample(diacritics[dir]); | |
}); | |
}); | |
} | |
}); | |
return heComes; | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment