Skip to content

Instantly share code, notes, and snippets.

View dergraf's full-sized avatar

Andre Graf dergraf

  • Basel, Switzerland
View GitHub Profile
Tambur = tambur_client:new(MY_API_KEY, MY_APP_ID, SECRET).
Tambur:publish("test_stream", "some message").
@dergraf
dergraf / gist:2659414
Created May 11, 2012 12:48
Simple tambur usage
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 */
};
};
@dergraf
dergraf / gist:2216802
Created March 27, 2012 15:15
pretty print timestamps in erlang
%% 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()).