Skip to content

Instantly share code, notes, and snippets.

@amandasposito
amandasposito / reinstallbundle.sh
Last active September 20, 2025 15:59
re-installing homebrew and keeping the formulas
brew bundle dump
# https://github.com/homebrew/install#uninstall-homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
# https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# restore packages
brew bundle
Repo.all from u in User,
preload: [{:investiment_funds, :institution}, :transfers]
Repo.all from u in User,
preload: [:investiment_funds, :transfers]
Repo.all from u in User,
preload: [:investiment_funds]
# Create a query
query = from u in User, where: u.age > 18
# Extend the query
query = from u in query, select: u.name
classes = (from klass in Class,
order_by: klass.created_at)
query = (from course in Course,
preload: [classes: ^classes])
(from c in Course,
join: class in assoc(c, :classes),
preload: [classes: class],
select: c)
(from c in Course,
preload: [classes: class],
select: c)
(from c in Course,
select: c)
def changeset(user, params \\ %{}) do
user
|> cast(params, [:name, :email, :age])
|> validate_required([:name, :email])
|> validate_format(:email, ~r/@/)
|> validate_inclusion(:age, 18..100)
|> unique_constraint(:email)
end