Skip to content

Instantly share code, notes, and snippets.

@fairjm
Last active June 6, 2019 04:32
Show Gist options
  • Save fairjm/bdf35b9637fc33d70065cad111d1154e to your computer and use it in GitHub Desktop.
Save fairjm/bdf35b9637fc33d70065cad111d1154e to your computer and use it in GitHub Desktop.
store some snippets
camelcase = fn a -> Regex.replace(~r/_([a-z]+)/,a, fn _,<<w::utf8, b::binary>> -> String.upcase(<<w>>) <> b end) end
upcaseFirst = fn
"" -> ""
<<a::utf8, b::binary>> -> String.upcase(<<a>>) <> b
end
# md5 see https://gist.github.com/10nin/5713366
def md5(data) do
Base.encode16(:erlang.md5(data), case: :lower)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment