Skip to content

Instantly share code, notes, and snippets.

View leonardokl's full-sized avatar

Leonardo Luiz leonardokl

View GitHub Profile
@threepointone
threepointone / feature-flags.md
Last active May 24, 2023 11:03
Feature flags: why, how, all that

(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)

Feature flags

This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).

So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.

Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -

@leonardokl
leonardokl / AbortController.js
Last active January 13, 2020 09:48
AbortController implementation with XMLHttpRequest - https://codesandbox.io/s/92vnjok08r
class AbortError extends Error {
name = "AbortError";
message = "Aborted";
}
class AbortSignal extends EventTarget {
aborted = false;
}
class AbortController {
@leonardokl
leonardokl / npm-version-cheatsheet.md
Last active July 2, 2024 08:09
npm version cheatsheet

NPM VERSION

Bump a package version

major (Breaking Change)

# version 1.0.0
$ npm version major # 2.0.0
$ npm version premajor # 2.0.0-0
@leonardokl
leonardokl / README.md
Created October 11, 2017 20:12
Convetional ChangeLog Prefixes

Convetional ChangeLog Prefixes

  • feat: A new feature

  • fix: A bug fix

  • BREAKING CHANGE: A breaking change

  • docs: Documentation only changes

@leonardokl
leonardokl / sh.js
Last active February 5, 2018 23:33
A function that spawns a new process using the given command, logging the stdout and stderr.
const cp = require('child_process')
/**
* A function that spawns a new process using the given command, logging the stdout and stderr.
*
* @param {String} command
* @param {Array} args
* @return {Promise}
* @example
*