Skip to content

Instantly share code, notes, and snippets.

disrupting absurdism

Paul Iannazzo boxxxie

disrupting absurdism
View GitHub Profile
boxxxie / match.clj
Created February 28, 2020 18:54
clojure.core.match+ (adding elixir style guards)
View match.clj
(ns loco.match
(:require [meander.epsilon :as m :refer [match]]
[clojure.walk :as walk]))
;;TODO: add this syntax to defun, and improve arglists
(defn guards-to-map
"transforms a single matching clause (with new :guard syntax) into supported syntax
e.g.: [sym _] :guard [sym [pred1 pred2]] return"
([matcher return] (list matcher return))
View ecto schema includes
defmodule Ecto.Schema.Includes do
defmacro include(module) do
quote do
Ecto.Schema.__include__(unquote(module), __MODULE__)
# Copy the field and association definitions from a module
def __include__(from_module, to_module) do
__include__(:fields, from_module, to_module)
View cool elixir shit
# first_year_maker = fn(path) ->
# fn {current_year, acc} = tuple ->
# acc_con = Map.get(acc, path)
# con = get_in(current_year, path)
# year = current_year.year_index
# case {con, acc_con} do
# {0.0, nil} -> tuple
# {nil, nil} -> tuple
# {nil, _} -> tuple
View .gitignore
View git config
name = Paul Iannazzo
email =
editor = emacsclient -t
logAllRefUpdates = true
excludesfile = ~/dot_files/.gitignore
ui = auto
View termite config
mouse_autohide = true
font = monospace 16
## from
# special
foreground = #c5c8c6
foreground_bold = #c5c8c6
cursor = #c5c8c6
View transpose.ex
# -------------------- transpose --------------------
def transpose(m) do
attach_row(m, [])
@doc """
Given a matrix and a result, make the first row into a column,
attach it to the result, and then recursively attach the
remaining rows to that new result.
View fish find -> sed
for f in (find . -type f)
sed -i 's/bad/good/g' $f
View nth functions for elixir
@doc """
This preforms an index lookup for data structures (tuple/list/Map)
def nth(index) do
tuple when is_tuple(tuple) ->
tuple |> elem(index)
enum ->
enum |>
boxxxie / mismatch.ex
Created October 9, 2016 18:06
in the below code, the is_map guard causes this code to take only that path, even when given a MapSet
View mismatch.ex
def empty(%MapSet{}), do:
def empty(obj) when is_map(obj), do: %{}