Skip to content

Instantly share code, notes, and snippets.

View archaelus's full-sized avatar

Geoff Cant archaelus

  • San Francisco, CA
View GitHub Profile
%%%-------------------------------------------------------------------
%% @copyright Geoff Cant
%% @author Geoff Cant <[email protected]>
%% @version {@vsn}, {@date} {@time}
%% @doc Test process group server
%% @end
%%%-------------------------------------------------------------------
-module(groupsrv).
-behaviour(gen_server).
info(Field, Rec) ->
Fields = fields(Rec),
FieldIdx = lists:zip(Fields, lists:seq(2,length(Fields)+1)),
element(proplists:get_value(Field,FieldIdx), Rec).
fields(#your_record{}) -> fields(your_record);
fields(your_record) -> record_info(fields, your_record).
to_proplist(R) ->
Keys = fields(R),
%%%-------------------------------------------------------------------
%% @copyright Process One inc.
%% @author Geoff Cant <[email protected]>
%% @version 1.0, {@date} {@time}
%% @doc Tsung protocol module behaviour and edoc.
%% @end
%%%-------------------------------------------------------------------
-module(ts_protocol).
-export([init_dynparams/0,
resolve(Path) ->
filename:join(resolve(filename:split(Path), [])).
resolve([], Acc) ->
lists:reverse(Acc);
resolve([".." | Rest], [_ | Acc]) ->
resolve(Rest, Acc);
resolve([".." | Rest], []) ->
resolve(Rest, []);
resolve([This | Rest], Acc) ->
%%%-------------------------------------------------------------------
%% @copyright Geoff Cant
%% @author Geoff Cant <[email protected]>
%% @version {@vsn}, {@date} {@time}
%% @doc Experimental replacement for inet_dns
%% @end
%%%-------------------------------------------------------------------
-module(ginet_dns2).
%% API
-module(mochiweb_signup_form_controller).
-export([serve_form/2]).
serve_form('GET', Req) ->
{ok, Form} = form:render(signup_form()),
Req:ok("text/html", Form);
serve_form('POST', Req) ->
Post = Req:parse_post(),
case form:valid_post(signup_form(), Post) of
-module(orbited_app).
-behaviour(application).
-export([start/0, start/2, stop/1]).
start() ->
application:load(orbited),
{ok, Deps} = application:get_key(orbited, applications),
lists:map(fun application:start/1,
Deps),
application:start(orbited).
%%% ====================================================================
%%% This software is copyright (c) 2006-2007, Process-one.
%%%
%%% $Id$
%%%
%%% @copyright 2006-2007 Process-one
%%% @author Christophe Romain <[email protected]>
%%% [http://www.process-one.net/]
%%% @author Bengt Kleberg <[email protected]>
%%% @version {@vsn}, {@date} {@time}
loop(Request) ->
try
process(Request)
catch
Class:Exception ->
Req:respond({500, [{"Content-Type", "text/plain"}],
io_lib:format("Couldn't process request ~p~n"
"Exception: ~p:~p~n"
"StackTrace:~p~n", [Request:dump(), Class, Exception,
erlang:get_stacktrace()])})