Skip to content

Instantly share code, notes, and snippets.

#vim-erlang_tools

https://github.com/fishcakez/vim-erlang_tools

Vim plugin to combine vim and tmux to add support for some erlang tools to vim. Inspired by the vimux plugin. Currently erlc, ct_run, dialyzer, eunit and rebar have some support.

The plugin works by using a ct hook or an eunit listener to produce identical format to dialyzer -o outputfile. This means all tools' output can be parsed

Dispatch = cowboy_router:compile([
{'_', [
{"/", cowboy_static,
[{directory, {priv_dir, web, []}},
{mimetypes, [{<<".html">>, [<<"text/html">>]}]},
{file, <<"index.html">>}]},
{"/js/[...]", cowboy_static,
[{directory, {priv_dir, web, [<<"js">>]}},
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}]},
@fishcakez
fishcakez / restforbug.erl
Created April 2, 2013 21:32
Rest for one restart bug.
-module(restforbug).
-export([start/0]).
start() ->
ok = application:start(restforbug),
exit(whereis(restforbug_first), bye).
-module(pecypc_session).
-author('Vladimir Dronnikov <[email protected]>').
%% -----------------------------------------------------------------------------
%% API exports
%% -----------------------------------------------------------------------------
-export([
add/1,
add/2,
defmodule MyReceive do
defmacro my_receive(do: clauses) do
extra = quote do
other -> IO.puts "got #{inspect other}"
end
quote do
receive do: unquote(clauses ++ extra)
end
end
defmodule FibAgent do
def start_link do
cache = Enum.into([{0, 0}, {1, 1}], HashDict.new)
Agent.start_link(fn -> cache end)
end
def fib(pid, n) when n >= 0 do
Agent.get_and_update(pid, &do_fib(&1, n))
end
=ERROR REPORT==== 12-Jun-2014::15:23:03 ===
** Task <0.38.0> terminating │
** Started by local_name_or_pid │
** When Function == #Fun<erlang.hd.1> │
** Arguments == [[]]
** Reason for termination ==
** {badarg,[{erlang,hd,[[]],[]},
{'Elixir.Agent.Server',handle_call,3,
[{file,"lib/agent/server.ex"},{line,11}]},
{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,580}]},
@proto_version "1.0"
def process_options(opts) do
env_args()
|> (&process_in(opts, &1)).()
|> (&process_err(opts, &1)).()
|> (&process_dir(opts, &1)).()
end
defp process_in(opts, args) do
File.read("match.exs") |> (fn({:ok, bin}) -> bin end).() |> String.length
#=> 156
s = """
id;name;value
1;foo;hi
2;bar;bye
"""
s
@fishcakez
fishcakez / enter_loop.ex
Last active August 29, 2015 14:04
EnterLoop
defmodule EnterLoop do
use GenServer
require Logger
def start_link(opts) do
spawn_opts = Keyword.get(opts, :spawn_opt, [])
# :infinity start timeout
:proc_lib.start_link(__MODULE__, :init_it, [opts], :infinity, spawn_opts)
end