Skip to content

Instantly share code, notes, and snippets.

@chrismcg
chrismcg / example_form_model.ex
Created August 2, 2015 11:34
Example Phoenix / Ecto Form Model
defmodule Phlink.Form do
use Ecto.Schema
import Ecto.Changeset
@primary_key false
schema "non_db_form.user" do
field :name, :string
field :thing, :string
end
@required_fields ~w(name)
@ygotthilf
ygotthilf / jwtRS256.sh
Last active June 2, 2024 21:46
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 1, 2024 08:46
set -e, -u, -o, -x pipefail explanation
@ftes
ftes / _error_messages.html.haml
Last active April 27, 2022 20:42
Rails bulma form builder with errors
-# layouts/_error_messages.html.haml
- if f.object.errors.any?
.notification.is-danger Please review the problems below:
- if f.object.errors[:base].present?
.notification.is-danger= f.object.errors[:base].join(', ')
@algas
algas / Makefile
Last active August 13, 2023 08:13
makefile subcommand example
NAMES = foo bar baz
hello: $(addprefix hello-, $(NAMES))
hello-%:
@echo "hello ${@:hello-%=%}"
world: $(addprefix world-, $(NAMES))
world-%: