Skip to content

Instantly share code, notes, and snippets.

View felippe-regazio's full-sized avatar
Coding

Felippe Regazio felippe-regazio

Coding
View GitHub Profile
@felippe-regazio
felippe-regazio / piano.js
Last active October 6, 2023 05:59
Turns your keyboard into a Piano
/*
Put this code on a page or paste on your console, then focus on the page
and try to press keys from q...p and a...l
*/
const getKeyFrequency = n => Math.pow(2, (n - 49) / 12) * 440;
const audioCtx = new AudioContext();
const playing = {};
window.addEventListener('keydown', e => {
@felippe-regazio
felippe-regazio / dummy-cli.js
Created May 25, 2023 00:55
Just a dummy node CLI
/*
Simple and dummy CLI in node. Usage
node cli.js <command> <-flags> <--options[=value]> <arguments>
Example:
node cli.js
node cli.js help
node cli.js hello

Improved .sr-only

Theorically bulletproof CSS class for visually hide anything and keep it accessible to ATs.

A Pen by ffoodd on CodePen.

License.

@felippe-regazio
felippe-regazio / tt-seek-and-destroy.js
Last active May 9, 2024 21:08
Automatically unfollow Twitter users by a given criteria
/**
* ABOUT
*
* This is a Twitter NO-API/Dependency-Free follower sniffer and auto-blocker.
*
* This function performs automatic bulk blocking with NO-API
* and NO-external-dependencies to run. You must run this snippet
* directly on your Console, it will sniff your followers list
* search for previous given keywords, if found on username or description,
* the user will be automatically blocked.
@felippe-regazio
felippe-regazio / challenge-scoreboard-ie10.js
Last active October 21, 2022 05:06
Simple gist that shows an implementation of a challenge
/**
Desafio intermediário de JavaScript:
Imagine que estou apostando corrida de carrinhos Hot Wheels com meu filho, e preciso de uma função JS pra registrar o placar.
O problema é que eu só tenho o Internet Explorer de 2010 pra fazer essa função, então tenho algumas regras
- não posso utilizar let nem const
- não posso manipular o escopo externo
- não posso utilizar nenhum mock
function typed(t, ...args) {
args.forEach(value => {
const typeMatch = t === 'array' ? Array.isArray(value) : typeof value === t;
if (!typeMatch) {
/**
* Você pode fazer o que quiser aqui. Se quiser parar a runtime,
* vc pode lançar um erro (throw new Error()). No nosso caso apenas
* vamos avisar que tipos estão diferindo mas deixar o programa
* continuar. Usamos console.warn + new Error inves de console trace
@felippe-regazio
felippe-regazio / exec-pipe.js
Created January 24, 2022 18:58
Execute a pipe of commands on linux or windows using Node
#!/usr/bin/env node
const exec = require('child_process').exec;
/**
* Cross-platform command execution script with promise pipe.
* If any part of pipe fail, the entire pipe will also fail.
*
* @param command string
* @returns Promise<String>
@felippe-regazio
felippe-regazio / unfollow-non-followers-twitter.js
Created December 20, 2021 04:39 — forked from gui25/unfollow-non-followers-twitter.js
Code to stop following those ones who are not following you back on Twitter and keeping those you want or follow anyone you want, with certain filters (working in July 2019)
/*
Unfollow (stop following) those people who are not following you back on Twitter (or unfollow everyone if desired).
This will work for new Twitter web site code structure (it was changed from July 2019, causing other unfollow-scripts to stop working).
Instructions:
1) The code may need to be modified depending on the language of your Twitter web site:
* For English language web site, no modification needed.
* For Spanish language web site, remember to set the 'LANGUAGE' variable to "ES".
* For another language, remember to set the 'LANGUAGE' variable to that language and modify the 'WORDS' object to add the words in that language.
@felippe-regazio
felippe-regazio / package.json
Created July 15, 2021 03:38 — forked from jayphelps/package.json
TypeScript output es2015, esm (ES Modules), CJS, UMD, UMD + Min + Gzip. Assumes you install typescript (tsc), rollup, uglifyjs either globally or included as devDependencies
{
"scripts": {
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min",
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js",
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz",
}
}
# use this command to add 5-seconds delay to the audio track of a video
#
ffmpeg -i input.mp4 -itsoffset 5 -i input.mp4 -map 0:v -map 1:a -vcodec copy -acodec copy delayed.mp4