This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(bench). | |
-compile(export_all). | |
run() -> | |
lists:sum([begin {T, _} = timer:tc(?MODULE, render, []), T end || _ <- lists:seq(1, 1000)]). | |
render() -> | |
Ctx = dict:from_list([{name, "Chris"}, {value, 10000}, {taxed_value, 10000 - (10000 * 0.4)}, {in_ca, true}]), | |
mustache:render("Hello {{name}} You have just won {{value}} dollars! {{#in_ca}} Well, {{taxed_value}} dollars, after taxes. {{/in_ca}}", Ctx). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(spam_behaviour). | |
-optional_callbacks([b/0]). | |
-callback a() -> ok. | |
-callback b() -> ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1> c(s). | |
{ok,s} | |
2> s:s(1, [<<"abc">>, "def", ["ghi"] | <<"jkl">>]). | |
{<<"a">>,[<<"bc">>,"def",["ghi"]|<<"jkl">>]} | |
3> s:s(2, [<<"abc">>, "def", ["ghi"] | <<"jkl">>]). | |
{<<"ab">>,[<<"c">>,"def",["ghi"]|<<"jkl">>]} | |
4> s:s(3, [<<"abc">>, "def", ["ghi"] | <<"jkl">>]). | |
{<<"abc">>,["def",["ghi"]|<<"jkl">>]} | |
5> s:s(4, [<<"abc">>, "def", ["ghi"] | <<"jkl">>]). | |
{[<<"abc">>,100],["ef",["ghi"]|<<"jkl">>]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-behaviour(gen_server). | |
init(_) -> | |
{ok, #state{member = undefined}}. | |
handle_call(_, _, #state{member = undefined} = State) -> {noreply, State}. | |
handle_cast({sync, Pids}, State) -> {noreply, #state{member = Pids}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-ifdef('GET_STACKTRACE_AVAILABLE'). | |
-define(CATCH_MATCH(__R), __R). | |
-define(GET_STACKTRACE(), erlang:get_stacktrace()). | |
-else. | |
-define(CATCH_MATCH(__R), __R:__StackTrace). | |
-define(GET_STACKTRACE(), __StackTrace). | |
-endif. |
- bbmustache v1.8.0
- refer: soranoba/bbmustache#41
This patch is provided with the same license as bbmustache.
If you patch bbmustache, you don't need to worry about the license.