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
%% pretty print timestamp from lager/src/lager_utils.erl | |
localtime_ms() -> | |
{_, _, Micro} = Now = os:timestamp(), | |
{Date, {Hours, Minutes, Seconds}} = calendar:now_to_local_time(Now), | |
{Date, {Hours, Minutes, Seconds, Micro div 1000 rem 1000}}. | |
format_time() -> | |
format_time(localtime_ms()). |
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
var connection = new tambur.Connection(MY_API_KEY, MY_APP_ID); | |
connection.ready = function() { | |
var stream = connection.get_stream("mystream"); | |
stream.onmessage = function(msg) { | |
/* do something fancy with the msg */ | |
}; | |
}; |
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
Tambur = tambur_client:new(MY_API_KEY, MY_APP_ID, SECRET). | |
Tambur:publish("test_stream", "some message"). |
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(dbis_sample). | |
-export([i_am_a_function/1, pattern/1]). | |
%% this is a comment | |
i_am_a_function(Param) -> | |
Number = 10, | |
Atom = atom, | |
String = "string", | |
EmptyList = [], | |
List = [Param, Number, Atom, String, EmptyList], |
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(continuation_test). | |
-export([test/0]). | |
-define(SIZE, 100). | |
test() -> | |
ets:new(test, [named_table]), | |
[ets:insert(test, {I, I}) || I<- lists:seq(1,?SIZE)], | |
{Res, Cont} = ets:match_object(test, {'_', '_'}, 10), | |
L = [p(R) || R <- Res], | |
c(Cont, L). |
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(kdtree). | |
-export([new/1, search/2, distance/2, test/0, test/3]). | |
new([]) -> []; | |
new(PointList) -> | |
K = size(lists:nth(1, PointList)), | |
kdtree(K, PointList, 0). | |
kdtree(_, [], _) -> []; | |
kdtree(K, PointList, Depth) -> |
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(hilbert). | |
-export([curve/1, curve/7, point_to_hilbert/3]). | |
-define(HILBERTMAP, [ | |
{a, [{{0,0},{0,d}}, {{0,1},{1,a}}, {{1,0},{3,b}}, {{1,1},{2,a}}]}, | |
{b, [{{0,0},{2,b}}, {{0,1},{1,b}}, {{1,0},{3,a}}, {{1,1},{0,c}}]}, | |
{c, [{{0,0},{2,c}}, {{0,1},{3,d}}, {{1,0},{1,c}}, {{1,1},{0,b}}]}, | |
{d, [{{0,0},{0,a}}, {{0,1},{3,c}}, {{1,0},{1,d}}, {{1,1},{2,d}}]} | |
]). |
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
make_request(Fun, Args) when is_function(Fun), is_list(Args) -> | |
Ref = make_ref(), | |
Caller = {self(), Ref}, | |
ReqF = fun() -> | |
exit({Ref, apply(Fun, [Caller|Args])}) | |
end, | |
try spawn_monitor(ReqF) of | |
{_, MRef} -> | |
receive | |
Ref -> |
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
{ | |
"id": 1, | |
"title": "VerneMQ", | |
"originalTitle": "VerneMQ", | |
"tags": [], | |
"style": "dark", | |
"timezone": "browser", | |
"editable": true, | |
"hideControls": false, | |
"sharedCrosshair": false, |
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(convert_retain_plugin). | |
-behaviour(auth_on_publish_hook). | |
-export([auth_on_publish/6]). | |
auth_on_publish(_UserName, _SubscriberId, _QoS, _Topic, _Payload, _IsRetain) -> | |
{ok, [{retain, false}]}. |
OlderNewer