View match.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Ecto.Schema.Includes do | |
defmacro include(module) do | |
quote do | |
Ecto.Schema.__include__(unquote(module), __MODULE__) | |
end | |
end | |
# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.agignore | |
.projectile |
View git config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Paul Iannazzo | |
email = somethingitalian@gmail.com | |
[core] | |
editor = emacsclient -t | |
logAllRefUpdates = true | |
excludesfile = ~/dot_files/.gitignore | |
[color] | |
ui = auto | |
[alias] |
View termite config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mouse_autohide = true | |
font = monospace 16 | |
## from http://terminal.sexy/ | |
[colors] | |
# special | |
foreground = #c5c8c6 | |
foreground_bold = #c5c8c6 | |
cursor = #c5c8c6 |
View transpose.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------- transpose -------------------- | |
def transpose(m) do | |
attach_row(m, []) | |
end | |
@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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in (find . -type f) | |
sed -i 's/bad/good/g' $f | |
end |
View nth functions for elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
This preforms an index lookup for data structures (tuple/list/Map) | |
""" | |
def nth(index) do | |
fn | |
tuple when is_tuple(tuple) -> | |
tuple |> elem(index) | |
enum -> | |
enum |> Enum.at(index) | |
end |
View mismatch.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def empty(%MapSet{}), do: MapSet.new() | |
def empty(obj) when is_map(obj), do: %{} |
NewerOlder