Skip to content

Instantly share code, notes, and snippets.

View churcho's full-sized avatar

Churchill Aboge churcho

  • Nairobi/Kenya
View GitHub Profile

Here is the Marathon JSON used to deploy Riak on Mesos backed by Flocker and Calico Docker Networking

{
	"id": "marathon-demo-riak",
	"apps": [{
		"id": "riak1",
		"container": {
			"type": "DOCKER",
@churcho
churcho / poolboy_demo.ex
Created January 26, 2017 15:47 — forked from henrik/poolboy_demo.ex
Example of using Poolboy in Elixir to limit concurrency (e.g. of HTTP requests).
defmodule HttpRequester do
use GenServer
def start_link(_) do
GenServer.start_link(__MODULE__, nil, [])
end
def fetch(server, url) do
# Don't use cast: http://blog.elixirsips.com/2014/07/16/errata-dont-use-cast-in-a-poolboy-transaction/
timeout_ms = 10_000
defmodule Abilities1 do
defimpl Canada.Can, for: User do
def can?(%User{id: user_id}, action, %Testimonial{id: testimonial_id})
when action in [:create], do: true
def can?(%User{id: user_id}, action, %Testimonial{id: testimonial_id})
when action in [:edit], do: true
end
end
defmodule BetterAbilities do
var npm = require("npm");
var fs = require("fs-extra");
var chokidar = require("chokidar");
var packagePaths = [
"../mobile-app/node_modules/shared-package/lib",
"../web-app/node_modules/shared-package/lib",
];
var noop = () => {};
@churcho
churcho / actionTypeBuilder.js
Created May 8, 2016 10:37 — forked from dbismut/actionTypeBuilder.js
React Redux Meteor middlewares
export function actionTypeBuilder(prefix) {
return {
type: actionType => `${prefix}/${actionType}`,
loading: actionType => `${actionType}/loading`,
ready: actionType => `${actionType}/ready`,
stopped: actionType => `${actionType}/stopped`,
changed: actionType => `${actionType}/changed`,
error: actionType => `${actionType}/error`,
success: actionType => `${actionType}/success`
};