Skip to content

Instantly share code, notes, and snippets.

@joeybaer
joeybaer / validate_creditcard.ex
Last active March 13, 2020 15:37
validate_creditcard
defmodule CreditCard do
def valid?(number) do
number
|> Integer.digits()
|> process_digits()
|> Enum.sum()
|> rem(10) == 0
end
defp process_digits(digits) do
length = Enum.count(digits)
@joeybaer
joeybaer / bus_stop.ex
Created March 11, 2020 23:35
Number of People in the Bus
defmodule Bus do
def number(stops) do
stops
|> Enum.reduce(0, fn {x, y}, acc -> acc + (x - y) end)
end
end
@joeybaer
joeybaer / keybase.md
Created February 26, 2018 17:56
Keybase

Keybase proof

I hereby claim:

  • I am joeybaer on github.
  • I am joeybaer (https://keybase.io/joeybaer) on keybase.
  • I have a public key ASA9DmZFQgFcZg4TdneHS-_9R6RzL313Y281foL47sUrsgo

To claim this, I am signing this object: