Skip to content

Instantly share code, notes, and snippets.

View thedgbrt's full-sized avatar
🏠
Working from home

Dagobert Renouf thedgbrt

🏠
Working from home
View GitHub Profile
@thedgbrt
thedgbrt / amplifyPushAlt.sh
Created September 25, 2019 10:46
Temporary alternative to amplifyPush.sh
#!/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} != "" ]];
@thedgbrt
thedgbrt / cards.ml
Last active February 3, 2017 16:55
(* 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 ) =
@thedgbrt
thedgbrt / flatten.js
Created February 2, 2017 00:05
JS flatten array
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]);
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.
@thedgbrt
thedgbrt / setTimeoutEasing.js
Last active August 29, 2015 14:10
Add easing to setTimeout loop
// 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;