Skip to content

Instantly share code, notes, and snippets.

View gist:2aa6711dfd1590c49ce4
defmodule MyApp.MainWorker do
use GenServer
# Client
def start_link(default) do
GenServer.start_link(__MODULE__, default)
def add(pid, num) do, {:add, num})
View gist:6ac809e2ab25578e774f
defmodule BusTracker.Session do
alias BusTracker.User
import Ecto.Repo
use Bustracker.Web, :model`?
def login(params, repo) do
user = repo.get_by(User, email: String.downcase(params["email"]))
case authenticate(user, params["password"]) do
true -> {:ok, user}
_ -> :error