Skip to content

Instantly share code, notes, and snippets.

@nathanl
Created August 4, 2016 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanl/d7aed499f9be753f227d193a6357c3f2 to your computer and use it in GitHub Desktop.
Save nathanl/d7aed499f9be753f227d193a6357c3f2 to your computer and use it in GitHub Desktop.
Zalgo text maker
defmodule Zalgo do
def this(string) do
String.graphemes(string)
|> Enum.map(fn (char) -> char <> the_funk end)
|> Enum.join
end
def the_funk do
accent_codes
|> Enum.map(fn (hex) ->
Integer.parse(hex, 16) |> elem(0)
end)
|> Enum.map(fn (int) ->
<< int :: utf8 >>
end)
|> Enum.join
end
def accent_codes do
# See more at http://unicode.org/charts/PDF/U0300.pdf
[
"302",
"302",
"302",
"0348",
"0348",
"0348",
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment