Skip to content

Instantly share code, notes, and snippets.

View boxxxie's full-sized avatar
👙
disrupting absurdism

Paul Iannazzo boxxxie

👙
disrupting absurdism
View GitHub Profile
@boxxxie
boxxxie / match.clj
Created February 28, 2020 18:54
clojure.core.match+ (adding elixir style guards)
(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))
for f in (find . -type f)
sed -i 's/bad/good/g' $f
end
@boxxxie
boxxxie / gist:3820403
Created October 2, 2012 16:00
converting .ape files to .flac with vlc in ubuntu
for ape_file in *.ape; do
file_name="${ape_file%.*}"
vlc "$ape_file" --no-sout-video --sout '#transcode{acodec=flac}:std{access=file,mux=raw,dst='"$file_name.flac" vlc://quit
done
#i know that there is an unclosed bracket, however when i close it it is added to the file name (sometimes). i just don't care. someone fix this if they find it anything useful.
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)
# 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
.agignore
.projectile
[user]
name = Paul Iannazzo
email = somethingitalian@gmail.com
[core]
editor = emacsclient -t
logAllRefUpdates = true
excludesfile = ~/dot_files/.gitignore
[color]
ui = auto
[alias]
mouse_autohide = true
font = monospace 16
## from http://terminal.sexy/
[colors]
# special
foreground = #c5c8c6
foreground_bold = #c5c8c6
cursor = #c5c8c6
# -------------------- 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.
@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