Skip to content

Instantly share code, notes, and snippets.

View erick-otenyo's full-sized avatar
🧭
Focusing

Erick Otenyo erick-otenyo

🧭
Focusing
View GitHub Profile
function(doc) {
if (doc.category === "venue") {
if (doc.name) {
index("name", doc.name, {"store": true,"index": true});
}
if (doc.geometry) {
index("lon", doc.geometry.coordinates[0], {"store": true,"index":false});
index("lat", doc.geometry.coordinates[1], {"store": true,"index":false});
}
if (doc.price_per_hour) {
@erick-otenyo
erick-otenyo / .block
Created May 1, 2018 10:26 — forked from dahis39/.block
Dendrogram + Grouped Horizontal Bar Chart
license: gpl-3.0
height: 1100

d3-bilevelLabelTooltip

This is a modified d3js bilevel partition in which labels and tooltips were added.

The idea is to have an abbreviation of the partition displayed and a tooltip with a fancier description and the size of that partition.

The base for this chart was Mike's Bilevel Partition. Tooltips thanks to Sharon Howard

@erick-otenyo
erick-otenyo / react-mapbox-gl-circle-blip.jsx
Last active October 7, 2018 12:39
Make a mapbox gl circle layer blip (pulsate) - React JS
import React from "react";
import ReactMapboxGl, { Source, Layer } from "react-mapbox-gl";
const Map = ReactMapboxGl({
accessToken: "YOUR_ACCESS_TOKEN_HERE"
});
class MapContainer extends React.Component {
constructor(props) {
super(props);
@erick-otenyo
erick-otenyo / cafes.geojson
Created October 14, 2018 21:17
Cafes around Nairobi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erick-otenyo
erick-otenyo / react-modal-portal.js
Created December 19, 2018 10:14 — forked from rmdort/react-modal-portal.js
Simple react modal using portals
import React from 'react'
import PropTypes from 'prop-types'
import ReactDOM from 'react-dom'
import cx from 'classnames'
const TAB_KEY = 9
const ESC_KEY = 27
const FOCUSABLE_ELEMENTS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA', 'A']
class ModalPortal extends React.Component {
{
/* Names of init files (in wwwroot/init), without the .json extension, to load by default */
"initializationUrls": ["icpac"],
"parameters": {
"googleUrlShortenerKey": null,
"googleAnalyticsKey": null,
"googleAnalyticsOptions": null,
/* Text that appears at the bottom of the map */
"disclaimer": {
"text": "",
{
"homeCamera": {
"west": 21.533203,
"south": -12.082296,
"east": 51.503906,
"north": 20.509355
},
"services": [],
"catalog": [
{
@erick-otenyo
erick-otenyo / pip-install-gdal.md
Created June 19, 2019 13:01 — forked from cspanring/pip-install-gdal.md
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

@erick-otenyo
erick-otenyo / geonode_to_terriajs.js
Last active October 2, 2019 11:30
Fetch geonode layers from api and format for Terra JS
const geonode2Terriajs = async (geonodeUrl,geonodeGeoserverUrl,proxyUrl)=> {
const catalog = []
try{
// fetch layers from geonode api, using proxy if provided
const layers = await fetch(proxyUrl?`${proxyUrl}/${geonodeUrl}`:geonodeUrl).then(res=>res.json()).then(layers=>layers.objects)
// group the layers by category
const layersByCategory = layers.reduce((all,layer)=>{