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 / phoenix_read_more_helper_snippet.ex
Created March 16, 2018 17:58 — forked from BillBarnhill/phoenix_read_more_helper_snippet.ex
Example of a Phoenix view helper (put in your view or in App views) that inserts a read more link
@doc """
Inserts a link to the show path of a resource item. The
item must implement .id.
##Example
<%= read_more_link @conn, @post %>
"""
def read_more_link(conn, item) do
export const isObjectEqual = (obj1, obj2) => {
if(!isObject(obj1) || !isObject(obj2)) {
return false;
}
// are the references the same?
if (obj1 === obj2) {
return true;
}
@churcho
churcho / .gitignore
Created September 13, 2017 15:01 — forked from ksauzz/.gitignore
Riak multi node setup script for single host.
nodes
@churcho
churcho / ArtistList.js
Created September 5, 2017 17:23 — forked from n1ru4l/ArtistList.js
mobx + apollo-client + react
import React from 'react'
import { observer } from 'mobx-react'
function ArtistList({ uiState: { artistData } }) {
const { data } = artistData;
if ( !data || !data.artists || !data.artists.length ) {
return <div>No artists bruh.</div>
}
const { artists } = data
return (
@churcho
churcho / gist:220ff5ce345dbff72ca0b13c1cda3efb
Created April 28, 2017 21:21 — forked from sdebnath/gist:36c235e042cb35db7d1f
Add field to Riak YZ Schema with CRDTs
This gist captures what needs to be done to add a new field to Riak's Yokozuna
search index.
Sources:
- https://github.com/basho/yokozuna/issues/130
- http://riak-users.197444.n3.nabble.com/How-to-update-existed-schema-td4032143.html
The code below is for illustration purposes only. Use at your own risk.
1. Create/Update new schema file
@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
@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 / 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" />
# 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 / 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