Skip to content

Instantly share code, notes, and snippets.

View elbrujohalcon's full-sized avatar
🇪🇸
Working from Catalunya

Brujo Benavides elbrujohalcon

🇪🇸
Working from Catalunya
View GitHub Profile
@elbrujohalcon
elbrujohalcon / my_mod.erl
Created April 5, 2017 01:24
A regular erlang module
-module(my_mod).
-export([whoami/0]).
whoami() -> my_mod.
-module(iterator).
-export([matching/1, catching/1]).
matching(Table) ->
matching(Table, ets:first(Table)).
matching(_Table, '$end_of_table') -> done;
matching(Table, Key) ->
io:format("~p: ~p~n", [Key, ets:lookup(Table, Key)]),
matching(Table, ets:next(Table, Key)).
-module(spts_coverage_SUITE).
-author('[email protected]').
-include_lib("mixer/include/mixer.hrl").
-mixin([
{spts_test_utils,
[ init_per_suite/1
, end_per_suite/1
]}
]).
-module(spts_api_serpents_SUITE).
-author('[email protected]').
-include_lib("mixer/include/mixer.hrl").
-mixin([
{spts_test_utils,
[ init_per_suite/1
, end_per_suite/1
]}
]).
-module(kvs).
-export([test/0]).
test() ->
[ catch test_creation()
, catch test_store_find()
, catch test_store_delete_find()
, … % more function calls like these
].
-module(temp).
-export([test/0]).
test() ->
100.0 = temp:f2c(212.0),
0.0 = temp:f2c(32.0),
ok.
@elbrujohalcon
elbrujohalcon / family.xml
Created November 13, 2016 17:39
XML family
<family xmlns='http://world.com/family'>
<parents>
<person gender='male' origin='Argentina'>Javier Lopez</person>
<person gender='female' origin='Ecuador'>Elvira Perez</person>
</parents>
<children>
<person gender='male' origin='Argentina'>Armando Lopez</person>
<person gender='male' origin='Guatemala'>Luciano Lopez</person>
</children>
</family>
-module(world_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, noargs).
init(noargs) ->
SupFlags = #{ strategy => one_for_one
-module(animals_sup).
-behaviour(supervisor).
-export([start_link/1, init/1]).
start_link(Name) -> supervisor:start_link({local, Name}, ?MODULE, Name).
init(Name) ->
SupFlags = #{ strategy => simple_one_for_one
@elbrujohalcon
elbrujohalcon / git.erl
Created October 12, 2016 15:12
Git for your Erlang Console
-module(git).
-export(['$handle_undefined_function'/2]).
'$handle_undefined_function'(Func, Args) ->
GitCommand = atom_to_list(Func),
GitArgs = [io_lib:format("~p ", [Arg]) || Arg <- Args],
Command = ["git ", GitCommand, $\s, GitArgs],
Output = os:cmd(Command),
io:format("~s~n", [Output]).