Skip to content

Instantly share code, notes, and snippets.

<head>
<meta charset="utf-8">
<title>Issue Example</title>
<link rel="stylesheet" href="css/styles.css?v=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.min.js" crossorigin="anonymous"></script>
</head>
<body style="margin:50px;padding:25px">
<h3>Issues in Repo</h3>
@mayel
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
@mayel
mayel / gist:a6ca4c2d0def19600e86803232b7709c
Created October 22, 2022 08:35
mix-docs-gh-pages-action.yaml
name: Generate mix docs & deploy to github pages
on:
push:
branches:
- main
jobs:
docs:
name: Generate & deploy
runs-on: ubuntu-latest
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
else
Atom
end
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.
Usage:
import Module.Extend
extend_module Common.Text
"""
defmacro extend_module(module) do
require Logger
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"@language": "und",
"Hashtag": "as:Hashtag",
"ValueFlows": "https://w3id.org/valueflows#",
"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"},
"om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/"
@mayel
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"},
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(
data,
opts \\ []
)
def input_to_atoms(data, opts) do
opts =
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)
SELECT
b0."id",
b0."feed_id",
b1."id",
b1."subject_id",
b1."verb_id",
b1."object_id",
b15."id",
b15."is_sensitive",
b20."id",