Skip to content

Instantly share code, notes, and snippets.

View josieusa's full-sized avatar
💭
I may be slow to respond.

Emiliano Daddario josieusa

💭
I may be slow to respond.
  • Italy
View GitHub Profile
@threepointone
threepointone / alternative.md
Last active July 31, 2022 17:46
list of things that don't do what they say they do

(also know as lies and/or alternative facts)

js

  • setImmediate - doesn't set anything immediately, waits for a tick before executing
  • setTimeout(fn, n) - never sets the timeout to exactly n
  • Math.random() - computers cannot generate random numbers
  • Promise - is a lie when rejected
  • Array.reduce - accumulates, does not reduce (via @sbmadhav)
@LucaColonnello
LucaColonnello / pipe-tag-es6-tpl-string.js
Created January 20, 2016 08:49
String leading whitespaces
// Strip margin (Leading whitespaces)
function pipeFactory( separator = ' ' ){
return (s, ...args) => {
return s
.map(( v, i ) => v + ( args[i] || '') )
.join('')
.replace(/(\r\n|\r|\n)([\s]+)?\|/g, separator)
;
};