Permalink
Browse files

Created gh-pages branch via GitHub

  • Loading branch information...
0 parents commit 3f577423142e3c3f6bd2479cf0575e3ca757e1ad @devinus committed Apr 3, 2012
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,53 @@
+var sectionHeight = function() {
+ var total = $(window).height(),
+ $section = $('section').css('height','auto');
+
+ if ($section.outerHeight(true) < total) {
+ var margin = $section.outerHeight(true) - $section.height();
+ $section.height(total - margin - 20);
+ } else {
+ $section.css('height','auto');
+ }
+}
+
+$(window).resize(sectionHeight);
+
+$(document).ready(function(){
+ $("section h1, section h2").each(function(){
+ $("nav ul").append("<li class='tag-" + this.nodeName.toLowerCase() + "'><a href='#" + $(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,'') + "'>" + $(this).text() + "</a></li>");
+ $(this).attr("id",$(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,''));
+ $("nav ul li:first-child a").parent().addClass("active");
+ });
+
+ $("nav ul li a").live("click",function(event) {
+ $("body").animate({scrollTop:$($(this).attr("href")).offset().top-190},400);
+ $("nav ul li a").parent().removeClass("active");
+ $(this).parent().addClass("active");
+ event.preventDefault();
+ });
+
+ sectionHeight();
+
+ $('img').load(sectionHeight);
+});
+
+fixScale = function(doc) {
+
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, true);
+ }
+
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, true);
+ }
+
+};
@@ -0,0 +1 @@
+{"note":"Don't delete this file! It's used internally to help with page regeneration.","tagline":"A hunky Erlang worker pool factory","name":"Poolboy","body":"Usage\r\n=====\r\n\r\n```erlang\r\nWorker = poolboy:checkout(PoolName),\r\nReply = gen_server:call(Worker, WorkerFun),\r\npoolboy:checkin(PoolName, Worker),\r\nReply.\r\n```\r\n\r\nExample\r\n=======\r\n\r\nThis is an example application showcasing database connection pools using\r\nPoolboy and Will Glozer's [epgsql](https://github.com/wg/epgsql).\r\n\r\n## example.app\r\n\r\n```erlang\r\n{application, example, [\r\n {description, \"An example application\"},\r\n {vsn, \"0.1\"},\r\n {applications, [kernel, stdlib, sasl, crypto, ssl]},\r\n {modules, [example, example_worker]},\r\n {registered, [example]},\r\n {mod, {example, []}},\r\n {env, [\r\n {pools, [\r\n {pool1, [\r\n {size, 10},\r\n {max_overflow, 20},\r\n {hostname, \"127.0.0.1\"},\r\n {database, \"db1\"},\r\n {username, \"db1\"},\r\n {password, \"abc123\"}\r\n ]},\r\n {pool2, [\r\n {size, 5},\r\n {max_overflow, 10},\r\n {hostname, \"127.0.0.1\"},\r\n {database, \"db2\"},\r\n {username, \"db2\"},\r\n {password, \"abc123\"}\r\n ]}\r\n ]}\r\n ]}\r\n]}.\r\n```\r\n\r\n## example.erl\r\n\r\n```erlang\r\n-module(example).\r\n-behaviour(application).\r\n-behaviour(supervisor).\r\n\r\n-export([start/0, stop/0, squery/2, equery/3]).\r\n-export([start/2, stop/1]).\r\n-export([init/1]).\r\n\r\nstart() ->\r\n application:start(?MODULE).\r\n\r\nstop() ->\r\n application:stop(?MODULE).\r\n\r\nstart(_Type, _Args) ->\r\n supervisor:start_link({local, example_sup}, ?MODULE, []).\r\n\r\nstop(_State) ->\r\n ok.\r\n\r\ninit([]) ->\r\n {ok, Pools} = application:get_env(example, pools),\r\n PoolSpecs = lists:map(fun({PoolName, PoolConfig}) ->\r\n Args = [{name, {local, PoolName}},\r\n {worker_module, example_worker}]\r\n ++ PoolConfig,\r\n {PoolName, {poolboy, start_link, [Args]},\r\n permanent, 5000, worker, [poolboy]}\r\n end, Pools),\r\n {ok, {{one_for_one, 10, 10}, PoolSpecs}}.\r\n\r\nsquery(PoolName, Sql) ->\r\n Worker = poolboy:checkout(PoolName),\r\n Reply = gen_server:call(Worker, {squery, Sql}),\r\n poolboy:checkin(PoolName, Worker),\r\n Reply.\r\n\r\nequery(PoolName, Stmt, Params) ->\r\n Worker = poolboy:checkout(PoolName),\r\n Reply = gen_server:call(Worker, {equery, Stmt, Params}),\r\n poolboy:checkin(PoolName, Worker),\r\n Reply.\r\n```\r\n\r\n## example_worker.erl\r\n\r\n```erlang\r\n-module(example_worker).\r\n-behaviour(gen_server).\r\n-behaviour(poolboy_worker).\r\n\r\n-export([start_link/1]).\r\n-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,\r\n code_change/3]).\r\n\r\n-record(state, {conn}).\r\n\r\nstart_link(Args) ->\r\n gen_server:start_link(?MODULE, Args, []).\r\n\r\ninit(Args) ->\r\n process_flag(trap_exit, true),\r\n Hostname = proplists:get_value(hostname, Args),\r\n Database = proplists:get_value(database, Args),\r\n Username = proplists:get_value(username, Args),\r\n Password = proplists:get_value(password, Args),\r\n {ok, Conn} = pgsql:connect(Hostname, Username, Password, [\r\n {database, Database}\r\n ]),\r\n {ok, #state{conn=Conn}}.\r\n\r\nhandle_call({squery, Sql}, _From, #state{conn=Conn}=State) ->\r\n {reply, pgsql:squery(Conn, Sql), State};\r\nhandle_call({equery, Stmt, Params}, _From, #state{conn=Conn}=State) ->\r\n {reply, pgsql:equery(Conn, Stmt, Params), State};\r\nhandle_call(_Request, _From, State) ->\r\n {reply, ok, State}.\r\n\r\nhandle_cast(_Msg, State) ->\r\n {noreply, State}.\r\n\r\nhandle_info(stop, State) ->\r\n {stop, shutdown, State};\r\nhandle_info({'EXIT', _, _}, State) ->\r\n {stop, shutdown, State};\r\nhandle_info(_Info, State) ->\r\n {noreply, State}.\r\n\r\nterminate(_Reason, #state{conn=Conn}) ->\r\n pgsql:close(Conn),\r\n ok.\r\n\r\ncode_change(_OldVsn, State, _Extra) ->\r\n {ok, State}.\r\n```\r\n\r\nOptions\r\n=======\r\n\r\n- `name`: the pool name\r\n- `worker_module`: the module that represents the workers\r\n- `size`: maximum pool size\r\n- `max_overflow`: maximum number of workers created if pool is empty\r\n\r\nAuthors\r\n=======\r\n- Devin Torres (devinus) <devin@devintorres.com>\r\n- Andrew Thompson (Vagabond) <andrew@hijacked.us>\r\n- Kurt Williams (onkel-dirtus) <kurt.r.williams@gmail.com>\r\n\r\nLicense\r\n=======\r\nPoolboy is available in the public domain (see `UNLICENSE`).\r\nPoolboy is also optionally available under the Apache License (see `LICENSE`),\r\nmeant especially for jurisdictions that do not recognize public domain works.","google":""}
Oops, something went wrong.

0 comments on commit 3f57742

Please sign in to comment.