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__) | |
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
# 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
.agignore | |
.projectile |
View git config
[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
mouse_autohide = true | |
font = monospace 16 | |
## from http://terminal.sexy/ | |
[colors] | |
# special | |
foreground = #c5c8c6 | |
foreground_bold = #c5c8c6 | |
cursor = #c5c8c6 |
View transpose.ex
# -------------------- 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
for f in (find . -type f) | |
sed -i 's/bad/good/g' $f | |
end |
View nth functions for elixir
@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
def empty(%MapSet{}), do: MapSet.new() | |
def empty(obj) when is_map(obj), do: %{} |
NewerOlder