Skip to content

Instantly share code, notes, and snippets.

@vKxni
vKxni / todoList.ex
Created July 5, 2022 11:40 — forked from hassanRsiddiqi/todoList.ex
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
@vKxni
vKxni / a-reverse-bench.exs
Created September 25, 2022 19:56 — forked from evadne/a-reverse-bench.exs
Reversing Binaries in Elixir
defmodule Benchmarker do
def run(title, module, function, size \\ 1024, iterations \\ 100) do
times = for (_ <- 1 .. iterations) do
data = :crypto.strong_rand_bytes(size)
{duration, _value} = :timer.tc fn ->
apply(module, function, [data])
end
duration
end