Skip to content

Instantly share code, notes, and snippets.

View markmelville's full-sized avatar

Mark Melville markmelville

  • Ancestry
  • Lehi, UT
View GitHub Profile
@markmelville
markmelville / percentile.js
Last active September 21, 2016 14:38 — forked from IceCreamYou/percentile.js
Utility functions to calculate percentiles and percent ranks in a JavaScript array.
// Returns the value at a given percentile in a sorted numeric array.
// "Linear interpolation between closest ranks" method
function percentile(arr, p) {
if (arr.length === 0) return 0;
if (typeof p !== 'number') throw new TypeError('p must be a number');
arr.concat().sort((a,b) => a-b);
if (p <= 0) return arr[0];
if (p >= 1) return arr[arr.length - 1];
var index = (arr.length - 1) * p,
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* Examples of some best practices
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
{"type":"object","required":["environments","modules"],"properties":{"environments":{"type":"object","description":"List of environments that will be deployed to by any module or pipeline in the project. Include any smoke environments.","patternProperties":{"^[a-z_][a-z0-9_]+$":{"type":"object","required":["name","awsAccount"],"properties":{"name":{"type":"string","description":"A display name with no semantic meaning."},"awsAccount":{"type":"string","description":"The account alias of the AWS account."}}}},"required":[]},"modules":{"type":"object","patternProperties":{"^[a-z_][a-z0-9_]+$":{"type":"object","required":["name","path","pipelines"],"properties":{"name":{"type":"string","description":"A display name with no semantic meaning."},"description":{"type":"string","nullable":true},"repo":{"type":"string","description":"The repo where source files are found in format: GithubOrg/RepoName. Defaults to the stack's primary repo.","nullable":true},"path":{"type":"string","description":"The path within the repo