Skip to content

Instantly share code, notes, and snippets.

{
"@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/"
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
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
@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
@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
<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 / up-manjaro.sh
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
#!/bin/sh
# 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 up.sh /usr/local/bin/up && chmod 755 /usr/local/bin/up
# and then run it from anywhere by simply entering the command: up
# By http://mayel.space
printf "WARNING: remember to make a backup with Timeshift first!"
# signup
mutation {
signup(email:"[email protected]", password:"mytestpw!", invite_code:"123")
}
# request another email confirmation to be sent
mutation {
requestConfirmEmail(email: "[email protected]")
# UndefinedFunctionError at POST /api/graphql
Exception:
** (UndefinedFunctionError) function Absinthe.Blueprint.TypeReference.Name.kind/0 is undefined or private
(absinthe) Absinthe.Blueprint.TypeReference.Name.kind()
(absinthe) lib/absinthe/type/built_ins/introspection.ex:106: anonymous fn/2 in Absinthe.Type.BuiltIns.Introspection.__absinthe_function__/2
(absinthe) lib/absinthe/resolution.ex:206: Absinthe.Resolution.call/2
(absinthe) lib/absinthe/phase/document/execution/resolution.ex:230: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe) lib/absinthe/phase/document/execution/resolution.ex:185: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
@mayel
mayel / keybase.md
Created August 26, 2018 12:19
Keybase identity proof

Keybase proof

I hereby claim:

  • I am mayel on github.
  • I am mayel (https://keybase.io/mayel) on keybase.
  • I have a public key ASCvFWmhxw1CwyXs8LmuHzuaMVMnPchOvm1Qlh3jaRbEdAo

To claim this, I am signing this object: