Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Dagobert Renouf thedgbrt

🏠
Working from home
Block or report user

Report or block thedgbrt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cards.ml
(* 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 Feb 2, 2017
JS flatten array
View flatten.js
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]);
View ApiClient.js
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 Aug 29, 2015
Add easing to setTimeout loop
View setTimeoutEasing.js
// 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;
You can’t perform that action at this time.