Skip to content

Instantly share code, notes, and snippets.

defmodule TestConsumer do
use Exrabbit.Consumer.DSL,
exchange: "test_topic_x", new_queue: "", no_ack: false
use GenServer
require Lager
def start_link(level) do
GenServer.start_link(__MODULE__, [level])
end
@knewter
knewter / roles_elixir_tasks_main.yml
Created August 18, 2014 14:23
elixir ansible deploy
---
- name: Create directory to put elixir in
sudo: 'yes'
shell: "mkdir -p /opt/elixir/v0.15.0"
- name: Install unzip
apt: name=unzip state=present update_cache=true
- name: Unzip elixir release
sudo: 'yes'
01:31:59.178 [error] Error in process <0.103.0> with exit value: {{badmatch,{error,{load_failed,"Failed to load NIF library: '/home/jadams/elixir/beam_toolbox_web/deps/sass/_build/dev/lib/sass/priv/sass.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE'"}}},[{...
iex(1)> :application.ensure_all_started(BeamToolboxData)
{:error,
{BeamToolboxData, {'no such file or directory', 'Elixir.BeamToolboxData.app'}}}
iex(1)> Mix.env
:dev
iex(2)> BeamToolboxData.Repo.start_link
** (FunctionClauseError) no function clause matching in Regex.match?/2
(elixir) lib/regex.ex:155: Regex.match?(~r/^[^:\/?#\s]+:\/\//, nil)
lib/ecto/utils.ex:29: Ecto.Utils.parse_url/1
lib/beam_toolbox_data/repo.ex:5: BeamToolboxData.Repo.conf/1
lib/ecto/repo/backend.ex:15: Ecto.Repo.Backend.start_link/2
[jadams:/home/jadams/elixir/beam_toolbox_data] master(+2/-2) ± MIX_ENV=test iex -S mix
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false]
Interactive Elixir (0.15.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Postgres.begin_test_transaction(BeamToolboxData.Repo)
** (UndefinedFunctionError) undefined function: Postgres.begin_test_transaction/1
Postgres.begin_test_transaction(BeamToolboxData.Repo)
iex(1)> Ecto.Adapters.Postgres.begin_test_transaction(BeamToolboxData.Repo)
** (exit) exited in: :gen_server.call(BeamToolboxData.Repo.Pool, {:checkout, true}, 5000)
** (EXIT) no process
iex(2)> BeamToolboxData.Project.create("foo")
** (Ecto.QueryError) function `or/2` not defined in query API
lib/ecto/query/validator.ex:295: Ecto.Query.Validator.type_check/2
lib/ecto/query/validator.ex:468: Ecto.Query.Validator.catch_grouped/1
lib/ecto/query/validator.ex:122: anonymous fn/3 in Ecto.Query.Validator.validate_booleans/3
(elixir) lib/enum.ex:537: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:537: Enum.each/2
lib/ecto/query/validator.ex:38: Ecto.Query.Validator.validate/3
lib/ecto/repo/backend.ex:85: Ecto.Repo.Backend.all/4
(beam_toolbox_data) lib/beam_toolbox_data/validation.ex:42: BeamToolboxData.Validation.unique/3
iex(1)> alias BeamToolboxData.Project
nil
iex(2)> Project.create("foo")
** (Ecto.QueryError) function `or/2` not defined in query API
lib/ecto/query/validator.ex:295: Ecto.Query.Validator.type_check/2
lib/ecto/query/validator.ex:468: Ecto.Query.Validator.catch_grouped/1
lib/ecto/query/validator.ex:122: anonymous fn/3 in Ecto.Query.Validator.validate_booleans/3
(elixir) lib/enum.ex:537: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:537: Enum.each/2
lib/ecto/query/validator.ex:38: Ecto.Query.Validator.validate/3
defmodule HexClient do
use HTTPoison.Base
@base_url "https://hex.pm/api/"
def packages, do: packages_path |> get_body
defp get_body(path), do: get(path).body
defp packages_path, do: "packages"
def process_url(url), do: @base_url <> url

Yup, so just run mix run image.exs on this sucker. You'll have to open the image manually if you're on a mac, and hey, storing it in my home dir might not work either :)