Skip to content

Instantly share code, notes, and snippets.

seancribbs /
Last active February 14, 2024 17:30
Presentation source, code examples and exercises from "Getting Started with eunit", Chicago Erlang March 2014

Getting Started with eunit

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.*

Okay, here are some of my tips about how I work with the pizza dough. For now, I'd suggest just buying the dough until you're comfortable, then once you've got the basic techniques down you can start experimenting and/or making your own dough. We get ours at Whole Foods (it's about $5/ball, it's 22 oz., and it'll make about three pizzas on the Baking Steel), but you can get it from a grocery store that makes pizzas or a pizza restaurant.. They'll usually sell it to you if you ask for it. I describe my process with the 3-pizza thing in mind.

Setting the stage

When you buy your dough it will usually be cold, and that cold is the enemy of smooth pizza making. You'll need to let the dough come to room temperature: We usually pull out three round plastic Ziploc containers, spray the containers lightly with non-stick kitchen spray, plop the cold dough into the container, then spray a small square of regular Saran wrap lightly with non-stick spray and cover the top of the containers. You want to block out the o

seancribbs /
Last active September 7, 2021 17:51 — forked from jszmajda/
Game of Life in Erlang

Conway's Game of Life in Erlang, in 2 hours, with 0 Erlang experience, in 20 lines of code.

1337 h4x0rs:

  • @jszmajda
  • @ngauthier
  • @ericoestrich
  • @danivovich
  • @kafuchau
seancribbs / ifelse.erl
Last active December 4, 2020 05:37
IF / ELSE in erlang, via parse_transform. EVIL, DO NOT USE
%% @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
seancribbs / application.rb
Created August 5, 2010 20:14
Code from the "Riak with Rails" webinar
# Add this line to your config/application.rb to enable
# initialization of Ripple, after the other framework railties
require 'ripple/railtie'
# To use the Riak cache store, place this line inside the
# Application class
config.cache_store = :riak_store
# 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, [, identifier, changeset])
|> maybe_merge_widget_options(identifier, params)
# Here's the usage of reduce. Notice the map + "mappend"(?) inside the reduce. If Ecto.Multi
;; Support mix format command
(defun alchemist-mix-format (&optional prefix)
"Runs mix format in the project"
(alchemist-mix-execute (list "format") prefix))
(defun alchemist-mix-format-buffer (&optional prefix)
"Runs mix format on the current buffer"
$ ack app_helper:get_env src
src/riak_client.erl:759: case app_helper:get_env(riak_kv, overload_backoff, undefined) of
src/riak_index.erl:444: Timeout = app_helper:get_env(riak_kv, secondary_index_timeout, ?DEFAULT_TIMEOUT),
src/riak_kv_app.erl:51: FSM_Limit = app_helper:get_env(riak_kv, fsm_limit, ?DEFAULT_FSM_LIMIT),
src/riak_kv_app.erl:60: case app_helper:get_env(riak_kv, direct_stats, false) of
src/riak_kv_app.erl:72: case app_helper:get_env(riak_kv, add_paths) of
src/riak_kv_app.erl:100: StorageBackend = app_helper:get_env(riak_kv, storage_backend),
src/riak_kv_app.erl:193: HealthCheckOn = app_helper:get_env(riak_kv, enable_health_checks, false),
src/riak_kv_app.erl:273: {Low, High} = app_helper:get_env(riak_kv, vnode_mailbox_limit, {1, 5000}),
src/riak_kv_app.erl:324: case app_helper:get_env(riak_kv, object_format, v0) of
seancribbs / init.el
Last active August 22, 2017 11:10
;; Use org-babel to load config
(require 'org)
(org-babel-load-file (expand-file-name "" user-emacs-directory))