Skip to content

Instantly share code, notes, and snippets.

iex(12)> M.infinity
1 : one (0 zeros)
10 : ten (1 zeros)
100 : one hundred (2 zeros)
1000 : one thousand (3 zeros)
10000 : ten thousand (4 zeros)
100000 : one hundred thousand (5 zeros)
1000000 : one million (6 zeros)
10000000 : ten million (7 zeros)
defmodule UserInput do
@doc "Takes a data structure and converts any keys in maps to (previously defined) atoms, recursively. By default any unknown string keys will be discarded. It can optionally also convert string values to known atoms as well."
def input_to_atoms(
opts \\ []
def input_to_atoms(data, opts) do
opts =
mayel / deps.ex
Last active September 30, 2023 10:00
bonfire deps by app size
bonfire: %{total: "3.56GiB", deps: "1.95GiB", app: "2.8MiB},
bonfire_ui_common: %{total: "2.04GiB", deps: "346.71MiB", app: "1.70GiB"},
iconify_ex: %{total: "333.30MiB", deps: "2.99MiB", app: "330.31MiB"},
bonfire_editor_milkdown: %{total: "1.80GiB", deps: "1.70GiB", app: "96.43MiB"},
ex_doc: %{total: "53.90MiB", deps: "423.44KiB", app: "53.49MiB"},
text_corpus_udhr: %{total: "45.08MiB", deps: "70.67KiB", app: "45.01MiB"},
bonfire_ui_me: %{total: "1.74GiB", deps: "1.70GiB", app: "32.16MiB"},
bonfire_editor_quill: %{total: "1.73GiB", deps: "1.70GiB", app: "27.69MiB"},
paper_trail: %{total: "22.43MiB", deps: "8.61MiB", app: "13.83MiB"},
"@context": [
"@language": "und",
"Hashtag": "as:Hashtag",
"ValueFlows": "",
"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"},
"om2": ""
defmodule Module.Extend do
@doc """
Extend a module (i.e. define `defdelegate` and `defoverridable` for all functions from the source module in the current module.
import Module.Extend
extend_module Common.Text
defmacro extend_module(module) do
require Logger
defmodule Types do
def typeof(nil), do: nil
def typeof(false), do: false
def typeof(true), do: true
def typeof(atom) when is_atom(atom) do
if function_exported?(atom, :__info__, 1) || Code.ensure_loaded?(atom) do
if function_exported?(atom, :__struct__, 0), do: :struct, else: Module
mayel / gist:a6ca4c2d0def19600e86803232b7709c
Created October 22, 2022 08:35
name: Generate mix docs & deploy to github pages
- main
name: Generate & deploy
runs-on: ubuntu-latest
mayel / open_modal_live.ex
Last active July 21, 2022 21:40
reusable modal in Surface/LiveView
defmodule Bonfire.UI.Common.OpenModalLive do
@moduledoc """
A button that opens a **modal**
use Bonfire.UI.Common.Web, :stateful_component
alias Bonfire.UI.Common.ReusableModalLive
@doc "The title of the modal. Only used if no title slot is passed."
prop title_text, :string
<meta charset="utf-8">
<title>Issue Example</title>
<link rel="stylesheet" href="css/styles.css?v=1.0">
<link rel="stylesheet" href="" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="" crossorigin="anonymous"></script>
<body style="margin:50px;padding:25px">
<h3>Issues in Repo</h3>
mayel /
Created January 2, 2022 01:14
up - script to keep Manjaro Linux up to date (Package updates, AUR, Node, Ruby and Python libs, etc) via the command line
# up - script to keep Manjaro Linux up to date (Package updates, AUR, Node, Ruby and Python libs, etc) via the command line
# run this to to install: cp /usr/local/bin/up && chmod 755 /usr/local/bin/up
# and then run it from anywhere by simply entering the command: up
# By
printf "WARNING: remember to make a backup with Timeshift first!"