Skip to content

Instantly share code, notes, and snippets.

View herminiotorres's full-sized avatar
🍇
Grapes Vibes

Herminio Torres herminiotorres

🍇
Grapes Vibes
View GitHub Profile
defmodule Parser do
def numero() do
fn
<<c::utf8>> <> rest ->
case c do
c when c in ?0..?9 -> {:ok, c - ?0, rest}
_ -> {:error, {:numero, :no_parse, c}, <<c::utf8>> <> rest}
end
end
end
@PJUllrich
PJUllrich / big-o.md
Last active April 28, 2024 14:19
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@JosephTLyons
JosephTLyons / gist:8c22fdf549917a7ee4f83b943f5863c7
Created June 14, 2023 22:13
Setting up mix formatter for Elixir in Zed
Source: https://github.com/zed-industries/community/issues/1526#issuecomment-1543891012
{
// ...
"language_overrides": {
"Elixir": {
"format_on_save": {
"external": {
"command": "mix",
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
}