Skip to content

Instantly share code, notes, and snippets.

@njwest
Last active July 20, 2024 17:20
Show Gist options
  • Select an option

  • Save njwest/ef076b0d740d65a1e011c8697dc9f21b to your computer and use it in GitHub Desktop.

Select an option

Save njwest/ef076b0d740d65a1e011c8697dc9f21b to your computer and use it in GitHub Desktop.
Rate Limiter with @doc
defmodule RateLimiter do
# ...code omitted
@doc """
Check the login attempt rate limit for a given email address.
iex> RateLimiter.allow_login_attempt?("doctest@example.com", 1)
true
iex> RateLimiter.allow_login_attempt?("doctest@example.com", 0)
false
"""
def allow_login_attempt?(email, limit \\ @email_request_limit) do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment