Skip to content

Instantly share code, notes, and snippets.

View lepfhty's full-sized avatar

Ricky Nguyen lepfhty

  • San Francisco, CA
View GitHub Profile
@lepfhty
lepfhty / index.html
Last active August 29, 2015 14:22
Cohort Analysis: Retention
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="style.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.9.3/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-tip/0.6.3/d3-tip.min.js"></script>
@lepfhty
lepfhty / heatmap.js
Last active August 29, 2015 14:04
Mortality Heat Map
"use strict";
function chart() {
var margin = { top: 100, right: 50, bottom: 100, left: 150 },
width = 500 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom,
x = d3.scale.ordinal().rangeBands([0, width]),
xlabel = d3.scale.ordinal().rangePoints([0, width], 1),
xaxis = d3.svg.axis().scale(xlabel).orient("bottom").tickSize(0,0),
y = d3.scale.ordinal().rangeBands([height, 0]),
@lepfhty
lepfhty / es-install.sh
Last active August 29, 2015 13:59
Copy this file and drop it in the top-level directory of your elasticsearch download. Edit the parameters at the top of the file. Make it executable `chmod +x es-install.sh`. Then run it `./es-install.sh`.
#!/bin/bash
ES_VERSION=0.90.10
ES_HOME=$PWD
ES_HEAP_SIZE=4096
ES_CLUSTER_NAME=elasticsearch
PLUGIN_LIST=(
'elasticsearch/elasticsearch-lang-javascript/1.4.0'
'elasticsearch/elasticsearch-mapper-attachments/1.9.0'
@lepfhty
lepfhty / elasticsearch-mongo-install.md
Last active June 5, 2016 19:13
Install Elasticsearch and MongoDB with river on Mac OSX.

Install Elasticsearch with Service Wrapper

# This code snippet is runnable

# Download Elasticsearch zip
curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.zip

# Unzip to desired location
unzip elasticsearch-0.90.7.zip -d $HOME
@lepfhty
lepfhty / dntagging.md
Created June 28, 2013 22:47
Data Ninja Tagging

[TOC]

Observation Records

Use Cases

Case 1: Simple Observation

A single observation record should have the following:

  1. a code or ID to identify the type of observation