Last active
June 6, 2019 04:32
-
-
Save fairjm/bdf35b9637fc33d70065cad111d1154e to your computer and use it in GitHub Desktop.
store some snippets
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
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