Skip to content

Instantly share code, notes, and snippets.

user = Repo.get(User, id)
%User{name: "jane", age: 24, email: "[email protected]"}
EctoAnon.run(user, Repo)
{:ok, %User{name: "redacted", age: 24, email: "redacted"}}
defmodule Manx.Lowering do
alias Beaver.MLIR
import MLIR.Sigils
import MLIR.{Transforms, Conversion}
alias Beaver.MLIR.Dialect.GPU
def tosa_vulkan(op) do
op
|> MLIR.Operation.verify!(dump_if_fail: true)
|> canonicalize
@royratcliffe
royratcliffe / foo.ex
Last active September 25, 2022 19:55
Elixir
‎‎​
@mrroot5
mrroot5 / elixir_type_protocol.ex
Created December 27, 2021 16:26
Elixir type protocol like Python. Keywrods: elixir, protocols, elixir protocols, type, elixir type, polymorphism, elixir polymorphism
defprotocol TypeProtocol do
@doc """
TypeProtocol checks a term type.
"""
@spec type(t) :: String.t()
def type(value)
end
defimpl TypeProtocol, for: Float do
@spec type(float) :: String.t()
@mister-coded
mister-coded / regex.md
Created August 24, 2021 10:16 — forked from vitorbritto/regex.md
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@litanur
litanur / readme.md
Last active November 12, 2024 19:29
Install MongoDB on Manjaro

How to install mongoDB on Manjaro 21 Ornara

  1. Enable AUR
  2. Make sure system is up to date sudo pacman -Syu
  3. To install, use the following command:
pamac build mongodb-bin
pamac build mongodb-tools-bin
pamac build mongodb-compass
@HiroNakamura
HiroNakamura / 00math.exs
Last active September 25, 2022 19:58
Ejercicios curso Elixir
defmodule Math do
def sum(a, b) do
a + b
end
end
@yowchun93
yowchun93 / deaf_aunty.exs
Created February 15, 2021 03:43
Elixir
defmodule DeafAunty do
def run do
read_input(0)
end
# main loop
defp read_input(consecutive_byes) when consecutive_byes < 3 do
IO.read(:stdio, :line)
|> String.trim
|> talk_to_aunty(consecutive_byes)
@ckampfe
ckampfe / bench.exs
Last active September 25, 2022 19:55
regex_str = "[a-z]+\\s+\\d+"
small_hit_str = "abc 123 def 456"
big_hit_str = Enum.reduce(1..1000, "", fn _val, acc ->
"#{acc}#{small_hit_str}"
end)
small_miss_str = "abc abc abc abc"
big_miss_str = Enum.reduce(1..1000, "", fn _val, acc ->
"#{acc}#{small_miss_str}"
end)
@hassanRsiddiqi
hassanRsiddiqi / todoList.ex
Created December 23, 2020 07:01
TodoList in Elixir using GenServer.
defmodule TodoList do
use GenServer
@moduledoc """
A TodoList add, list, find, update & remove.
"""
def start do
{:ok, state} = GenServer.start_link(__MODULE__, [])
state
end