Skip to content

Instantly share code, notes, and snippets.

View churcho's full-sized avatar

Churchill Aboge churcho

  • Nairobi/Kenya
View GitHub Profile
@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`
};
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 = () => {};
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
@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

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 / README.md
Created April 26, 2017 14:02 — forked from archenroot/README.md
Docker service discovery with HAproxy, consul and registrator on Docker Machine and Docker Swarm
# Just for perf, you can skip this.
START_SEC=$(date +'%s')
# Creating network.
docker-machine ssh node-1 "docker network create --driver overlay proxy"
# Grab the source.
docker-machine ssh node-1 "curl -o docker-compose-stack.yml https://raw.githubusercontent.com/vfarcic/docker-flow-proxy/master/docker-compose-stack.yml"
# Create docker-flow-proxy and docker-flow-swarm-listener services.
@churcho
churcho / schema.xml
Created April 28, 2017 20:51 — forked from ChristopherBiscardi/schema.xml
Solr/Yokozuna/Riak Search 2 Schema for GeoSpatial Indexing.
<?xml version="1.0" encoding="UTF-8"?>
<schema name="geotest" version="1.5">
<uniqueKey>_yz_id</uniqueKey>
<fields>
<field name="name" type="string" indexed="true" stored="true"/>
<field name="loc" type="location_rpt" indexed="true" stored="true" />
<!-- Begin Yokozuna Fields -->
<field name="_yz_id" type="_yz_str" indexed="true" stored="true" required="true" />
@churcho
churcho / add_data.sh
Created April 28, 2017 21:13 — forked from drewkerrigan/add_data.sh
Geospatial query example with Solr
curl -XPOST http://localhost:8098/types/location_type/buckets/people/datatypes/person1 \
-H "Content-Type: application/json" \
-d '
{
"update": { "username_register": "user1", "city_register": "Denver", "state_register": "NY", "position_register": "42.27,-74.53" }
}'
curl -XPOST http://localhost:8098/types/location_type/buckets/people/datatypes/person2 \
-H "Content-Type: application/json" \
-d '
@churcho
churcho / setup.md
Created April 28, 2017 21:13 — forked from drewkerrigan/setup.md
simple Riak default schema search setup

Simple Search 2.0 Setup

Create an index
curl -i -XPUT http://localhost:8098/search/index/my_index
Link the index to a bucket