Skip to content

Instantly share code, notes, and snippets.

@willmendesneto
willmendesneto / medis-installer.sh
Last active June 19, 2023 11:56
Script to build and install Redis Desktop Manager Medis Locally on MacOS
echo "Installing Redis Desktop Manager 'Medis'"
[ -d ~/medis ] || git clone https://github.com/luin/medis.git ~/medis
cd ~/medis
npm install && npm run pack
cp -rf out/Medis-mas-x64/Medis.app /Applications/
cd ~ && rm -rf ~/medis
@willmendesneto
willmendesneto / settings.json
Last active October 19, 2022 02:31
VSCode: Settings configuration
{
"workbench.startupEditor": "newUntitledFile",
"workbench.activityBar.visible": false,
"editor.multiCursorModifier": "ctrlCmd",
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/.tmp": true,
"**/.DS_Store": true
@willmendesneto
willmendesneto / a11y-dev-mode.css
Last active May 17, 2022 13:30
Using CSS for highlight errors in HTML - A11Y Linting HTML with CSS
/* Highliting accessibility errors in HTML */
/* highlight HTML element with invalid value for lang attribute */
html:not([lang]),
html[lang=""] {
border: 2px dotted red !important;
}
/* highlight images missing alt text */
img:not([alt]) {
With registered links
  #hasAny
    ✅ is true
  #all
    ✅ is a list of all registered links
Without registered links
  #hasAny
    ✅ is false
 #all
# Creating folder jumping on the created folder
mkdir multiple-package-versions-in-project && \
cd multiple-package-versions-in-project \
# Starting a NPM project
npm init -y && \
# Installing old & new versions of `feature-toggle-service` package
npm install --save \
  feature-toggle-service@npm:feature-toggle-service@4.0.0 \
 feature-toggle-service-next@npm:feature-toggle-service@6.0.0
@willmendesneto
willmendesneto / index.js
Created July 13, 2021 03:11
Using multiple versions of the same package in a project: index.js
const { isOn, set } = require('feature-toggle-service');
const { isOn: isOnNext, set: setNext } = require('feature-toggle-service-next');
const defaultConfig = { enableFirstSection: true };
set(defaultConfig);
setNext(defaultConfig);
// ❌ Old version: does NOT have a `debug` option
console.log(isOn('enableFirstSection'));
// ✅ Latest version: does have a `debug` option available
@willmendesneto
willmendesneto / package.json
Created July 13, 2021 03:09
Using multiple versions of the same package in a project: package.json
{
"name": "multiple-versions-of-package-in-project",
"version": "1.0.0",
"description": "Using multiple versions of the same package in a project",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "Will Mendes <willmendesneto@gmail.com>",
@willmendesneto
willmendesneto / README.md
Created July 13, 2021 03:06
Using multiple versions of the same package in a project

How to apply that

  1. Install the packages (old and latest versions) adding a specific name/namespace for the latest one
npm install --save \
  feature-toggle-service@npm:feature-toggle-service@4.0.0 \
  feature-toggle-service-next@npm:feature-toggle-service@6.0.0
// Link for example in Typescript playground
// https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABAcwKZQMIODZAKAWAChFTEJtcB+ALkQG9iznEBDAB3dVYCdXJUtRAGcoPGGGQBuJi1L8YAW1awEQ0eMkyScxABs4rACYTkAFVQAPKOrGntu8nHA26YEIoBGqHg91QAC1RFQTp6AG0AazoNUwBdOn4ATwBfRAAfRHc9PT9SFOIASjoANzgYIwZZUgowUQYOLl5+CFREAF5EAHI9CVQugBo2MCUVeCROrvYeOGQeVGFhQcRA4LbO7L0hg2NTC2sO7oAZQxNJADpL5YoXQ4BGNM7anGQMzPoU7WqnOrg9VHOBnwjW4fAEQwUylUYCGqxC21OeysUCGNzAUEK2gKRGIoEg0JQ6CwYBeACZCDoapRkEJGJSWCDmgJbJppN9mJCxmoYnYtOyyDszuZkSz7PyqS4hO4vD48iw4aEGFEeayEsNUhksiAcnLscVEGUKlV6bV6oywa1Ds9qOdzS02lQqN1emB+nLTVBhqMCU9qVRbSMoeNEI7utNZvNFl13Qh6gqrX7zvHQ5sY3VPYKkQdfSSbZnJPtPaGuiddhcrmn6mjPTmXv7qyGnXcvibY38AUC8HbwV6gwhYUF4fpEQXkajnOjMcRsbjwNBg2hMNSAMwU5jWmlhcVsTig+2ivn0jmBrlgA9so8CkfC6znuXrieuLUy3zbhW05UiXnINXJNKZVNvj1UpykqOkH3TBpdyZS1JhdfoIRPH0wxmOYFiWAc1kOTYETLG8a2Oa9LnOa5H3uR4fheRsGE+YhvlNdtAVmLtoItVBEO9cZMKHfN8PHFwpyIFIgA
function getConfig(
config?: {
appearance?: string;
animation?: string;
loadingText?: string;
node example.js | pino-sanitize -u=":{UUID}" -h=":{HASH}" -q=":{QUERY-STRING}" -k="err,msg,stack"