Skip to content

Instantly share code, notes, and snippets.

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

Diego Borges drborges

🏠
Working from home
View GitHub Profile
package main
import (
"fmt"
"time"
"sync"
)
func timedPrint(number int64, group *sync.WaitGroup) {
time.Sleep(time.Duration(number) * time.Millisecond)
@bendc
bendc / functional-utils.js
Last active December 25, 2025 22:31
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)

quick-heroku

Containerized ephemeral heroku-like local environment

Requirements

Usage

@MACSkeptic
MACSkeptic / good-morning.js
Created July 29, 2013 10:09
callback is invoked only for indexes of the array which have assigned values (from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
[1, 2].map(function (x) { return x; }) // -> [1, 2]
[1,, 2].map(function (x) { return x; }) // -> [1, undefined × 1, 2]
[1, 2].map(function () { return 'constant'; }) // -> ["constant", "constant"]
[1,, 2].map(function () { return 'constant'; }) // -> ["constant", undefined × 1, "constant"]