Skip to content

Instantly share code, notes, and snippets.

Sean Cribbs seancribbs

View GitHub Profile
View reduce.ex
# This function is only included for context - it creates a multi-operation transaction structure
# for a single widget and its associated options
def create_multi(params, operation_type, widget, identifier \\ :widget) do
changeset = Widget.changeset(widget, params)
apply(Ecto.Multi, operation_type, [Ecto.Multi.new(), identifier, changeset])
|> maybe_merge_widget_options(identifier, params)
end
# Here's the usage of reduce. Notice the map + "mappend"(?) inside the reduce. If Ecto.Multi
View alchemist-mix-format-spacemacs.el
;; Support mix format command
(defun alchemist-mix-format (&optional prefix)
"Runs mix format in the project"
(interactive)
(alchemist-mix-execute (list "format") prefix))
(defun alchemist-mix-format-buffer (&optional prefix)
"Runs mix format on the current buffer"
(interactive)
View print_code.ex
defmodule Mix.Tasks.PrintCode do
@shortdoc "Prints decompiled Erlang source for a module"
@moduledoc """
Pretty-prints the *Erlang-equivalent* source code of an *Elixir*
module. This is useful for understanding how particular Elixir
features (e.g. macros, protocols) operate under the covers.
*Erlang modules are not yet supported.*
@seancribbs
seancribbs / qcon-nyc-2017-resources.md
Last active Jul 29, 2017
Resources for my talk "Adopting Stream Processing for Instrumentation" at QCon New York 2017
@seancribbs
seancribbs / init.el
Last active Aug 22, 2017
seancribbs.com/emacs.d
View init.el
;; Use org-babel to load config
(require 'org)
(org-babel-load-file (expand-file-name "seancribbs.org" user-emacs-directory))
@seancribbs
seancribbs / ifelse.erl
Last active Nov 19, 2015
IF / ELSE in erlang, via parse_transform. EVIL, DO NOT USE
View ifelse.erl
%% @doc A VERY EVIL parse_transform that allows two things:
%%
%% 1) The use of 'else' instead of 'true' in the final clause of an if
%% expression.
%%
%% 2) Automatic extraction of non-guard expressions into
%% anonymous variables that can then be used directly in the clause
%% guards.
%%
%% Until Erlang actually implements the 'cond' construct, this is a
View gist:1c59b5dc1aa50b83c53e
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:git, 'git://github.com/basho/lager.git', {:tag, '2.1.1'}}
(elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir) lib/string/chars.ex:17: String.Chars.to_string/1
(mix) lib/mix/rebar.ex:122: Mix.Rebar.compile_req/1
(mix) lib/mix/rebar.ex:88: Mix.Rebar.parse_dep/2
(elixir) lib/enum.ex:977: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:977: Enum.map/2
(mix) lib/mix/dep/loader.ex:250: anonymous fn/2 in Mix.Dep.Loader.rebar_children/1
View keybase.md

Keybase proof

I hereby claim:

  • I am seancribbs on github.
  • I am seancribbs (https://keybase.io/seancribbs) on keybase.
  • I have a public key whose fingerprint is C40B E0F2 EA7F B696 8D69 E1D1 2AAA 6B61 8089 7A6C

To claim this, I am signing this object:

View .bash_profile
# Customizations
. ~/.bash/colors.sh
. ~/.bash/editor.sh
. ~/.bash/git.sh
. ~/.bash/erlang.sh
. ~/.bash/ruby.sh
. ~/.bash/ghc.sh
. ~/.bash/prompt.sh
. ~/.bash/gif.sh
View neotoma_generate.erl
%% @doc Implements code-generation using syntax_tools.
-module(neotoma_generate).
-include("neotoma.hrl").
-compile(export_all).
-import(erl_syntax, [
application/3,
abstract/1,
case_expr/2,
clause/3,
variable/1,
You can’t perform that action at this time.