Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
// fizzbuzz ramda-style
var R = require('ramda');
R.forEach(R.cond([
[R.pipe(R.modulo(R.__, 15), R.equals(0)), R.always('FizzBuzz')],
[R.pipe(R.modulo(R.__, 3), R.equals(0)), R.always('Fizz')],
[R.pipe(R.modulo(R.__, 5), R.equals(0)), R.always('Buzz')],
[R.T, R.identity]
]), R.range(1, 101));
//with a helper function
@StevenACoffman
StevenACoffman / fizzbuzz.js
Last active August 29, 2015 14:27 — forked from TGOlson/fizzbuzz.js
Point-free JavaScript FizzBuzz Kata
var R = require('ramda');
var factorOf = R.compose(R.equals(0), R.flip(R.modulo));
var getFizzBuzz = R.cond([
[factorOf(15), R.always('FizzBuzz')],
[factorOf(5), R.always('Buzz')],
[factorOf(3), R.always('Fizz')],
[R.T, R.identity]
]);
@StevenACoffman
StevenACoffman / setenv.sh
Created September 3, 2015 13:57 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ ____
# /_ __/___ ____ ___ _________ _/ /_ ( __ )
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / __ |
# / / / /_/ / / / / / / /__/ /_/ / /_ / /_/ /
# /_/ \____/_/ /_/ /_/\___/\__,_/\__/ \____/
#
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@StevenACoffman
StevenACoffman / index.js
Last active January 27, 2016 18:10 — forked from roman01la/index.js
Broken but not sure why
const mapping = (f) => (reducing) => (result, input, index) => reducing(result, f(input, index));
const filtering = (predicate) => (reducing) => (result, input, index) => predicate(input) ? reducing(result, input, index) : result;
const ALPHABET = 'abcdefghijklmnopqrstuvwxyz'.split('');
const NUMBERS = '0123456789'.split('');
const isAlphaNumeric = (letter) => ALPHABET.indexOf(letter) !== -1 || NUMBERS.indexOf(letter) !== -1;
const periodicallyPad = (current, index) => index !== 0 && index % 5 === 0 ? ' ' + current : current;
const concatenate = (xs, x, index) => xs.concat(x);
const result = 'I AM SO EXCITED ABOUT TRANSDUCERS'.toLowerCase().split('')
@StevenACoffman
StevenACoffman / BigBingo
Created August 1, 2016 14:36 — forked from alangpierce/BigBingo
BigBingo (as of early July 2014)
Snapshot of Khan Academy's BigBingo A/B testing framework and related code.
Here's a basic overview:
-summarize.py is the most interesting file. It contains all stages of the
summarize task, as well as the publish and archive steps that happen at the
end.
-bq_pipelines.py contains lots of useful pipelines for interacting with
BigQuery. QueryToTableBatchPipeline can run many simultaneous queries, and will
properly handle all batching and retry logic.
-config.py is where all experiment configuraiton lives. For this Gist, I
#!/bin/bash
# expects the lambda function .py file to be in the same directory as this script.
# based off of Amazon's official documentation:
# http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python
# get the lambda function
lambda_func_file=$1
lambda_func="${lambda_func_file%.*}"
# exit if no file specified
[[ -z "$1" ]] && { echo "Lambda function is empty" ; exit 1; }
# generate a deployment timestamp
@StevenACoffman
StevenACoffman / lambda.py
Created February 12, 2017 17:29 — forked from babo/lambda.py
Simple AWS lambda job to create an SQS event for each S3 events.
#!/usr/bin/env python
import argparse
import logging
try:
from urllib import splittype
except ImportError:
from urllib.parse import splittype
import boto3
@StevenACoffman
StevenACoffman / wti
Created February 15, 2017 15:14 — forked from RomiC/wti
Sample of using JIRA Rest API via bash, curl and sed.
#!/bin/bash
usage() {
echo "
Usage: wti [-h?] [-l LOGIN] ISSUE...
wti = \"(W)hat (T)he (I)ssue?\". Script tries to get description of the specified
ISSUE(es) from jira. For each ISSUE in list script will ouput the line in
the following format: ISSUE_ID — ISSUE_DESC
#!/bin/bash
#This script requires an up-to-date version of the aws cli tool
profile=$1
environment=$2
region=us-east-1
service_name=com.amazonaws.$region.s3
get_env_vpc_id () {
@StevenACoffman
StevenACoffman / req-mapping.json
Created March 4, 2017 18:12 — forked from pmuellr/req-mapping.json
aws api gateway integration request mapping template for aws lambda
{
"method": "$context.httpMethod",
"resourcePath": "$context.resourcePath",
"querystring": {
#foreach($key in $input.params().querystring.keySet())
"$key": "$input.params().querystring.get($key)"#if($foreach.hasNext),#end
#end
},
"path": {
#foreach($key in $input.params().path.keySet())