This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ecto.Changeset | |
@spec validate_email(Ecto.Changeset.t(), atom) :: Ecto.Changeset.t() | |
def validate_email(changeset, field) when is_atom(field) do | |
changeset | |
|> validate_length(field, max: 160) | |
|> validate_change(field, &validate_email_rfc5322/2) | |
end | |
defp validate_email_rfc5322(field, email) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script generated by ChatGPT, no edits | |
# Example: ./check_missing_translations.sh apps/my_app_web/priv/gettext/ja | |
# Ensure the script is given an argument (the folder to check) | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <locale_folder>" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
Converts a list of values into an AST for defining a type. | |
Source: https://elixirforum.com/t/dynamically-generate-typespecs-from-module-attribute-list/7078/16 | |
## Usage | |
@categories [:one, :two, :three] | |
@type category :: unquote(list_to_typespec(@categories)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# File: git_horoscope.sh | |
# Description: This script uses the OpenAI API to generate your daily horoscope | |
# based on your Git commits of the last seven days. | |
# Requirements: | |
# - https://github.com/openai/openai-python installed and in the $PATH | |
# - configured OpenAI API key (export OPENAI_API_KEY=abc) | |
# - Github CLI installed and configured | |
# Usage: ./git_horoscope.sh author |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"defaults": { | |
"reporters": [ | |
"pa11y-ci-reporter-html" | |
], | |
"runners": ["axe", "htmlcs"], | |
"includeNotices": false, | |
"includeWarnings": true, | |
"standard": "WCAG2AAA" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Repo do | |
use Ecto.Repo, | |
otp_app: :my_app, | |
adapter: Ecto.Adapters.Postgres | |
alias Ecto.Queryable | |
alias Ecto.Schema | |
@doc """ | |
Fetches a single struct from the data store where the primary key matches the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
Takes a list of Ecto.Enum fields and converts them into Absinthe enum | |
types. | |
## Usage | |
The list consists of tuples with the name of the GraphQL enum, the Ecto schema | |
module and the schema field using `Ecto.Enum`. | |
use Absinthe.Schema.Notation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
Defines an enum in your Absinthe schema from an enum defined with `EctoEnum`. | |
## Example | |
If you defined an enum with `EctoEnum` like this: | |
defmodule MyApp.Enums do | |
import EctoEnum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am woylie on github. | |
* I am woylie (https://keybase.io/woylie) on keybase. | |
* I have a public key ASDwF_R5sK547hgF8evUJkY9byG-zuI6mcNnJWjX-Ew_jQo | |
To claim this, I am signing this object: |