This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// self-invoking function | |
// main idea from here http://stackoverflow.com/questions/12081547/applying-easing-to-settimeout-delays-within-a-loop | |
// easing functions from here https://github.com/danro/jquery-easing/blob/master/jquery.easing.js | |
(function(){ | |
var time = 0; | |
var diff = 12; | |
var minTime = 1; | |
var maxTime = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import superagentCache from 'superagent-cache'; | |
import config from '../config'; | |
const methods = ['get', 'post', 'put', 'patch', 'del']; | |
const superagent = superagentCache(null, {backgroundRefreshInterval: 500}); | |
function formatUrl(path) { | |
const adjustedPath = path[0] !== '/' ? '/' + path : path; | |
if (__SERVER__) { | |
// Prepend host and port of the API server to the path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flatten(arr){ | |
var flatArr = []; | |
var recursive = function(arr2) { | |
if(arr2.length == 0) { | |
return; | |
} else if (Array.isArray(arr2[0])) { | |
recursive(arr2[0]); | |
} else { | |
flatArr.push(arr2[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* It's code I wrote while solving a problem in a Functional Programming course in December 2016 *) | |
(* Coming from OOP, I love how elegant and readable it is *) | |
fun card_value ( card : card ) = | |
case card of | |
( _, Num i ) => i | |
| ( _, Ace ) => 11 | |
| ( _, _ ) => 10 | |
fun sum_cards ( cs : card list ) = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
IFS='|' | |
# if no provided environment name, use default env variable, then user override | |
if [[ ${ENV} = "" ]]; | |
then | |
ENV=${AWS_BRANCH} | |
fi | |
if [[ ${USER_BRANCH} != "" ]]; |