Skip to content

Instantly share code, notes, and snippets.

View Nick-Gabe's full-sized avatar
💻
Coding

Nícolas Gabriel Nick-Gabe

💻
Coding
View GitHub Profile
function calcularRendaInvestindoParcelas(valor, meses, incluirIOF = true) {
const CDI = 13;
let rendimento = 0;
for(let index = 0; index < meses; index++) {
const saldoRestante = valor - valor / meses * index;
const porcentagemRendaMensal = CDI / 100 / 12;
rendimento += (saldoRestante + rendimento) * porcentagemRendaMensal;
if(index === 0 && incluirIOF) {
// IOF no primeiro mês
@Nick-Gabe
Nick-Gabe / cat.js
Last active November 26, 2023 05:48
cat zap zap web
setInterval(() => {
i=atob('aHR0cHM6Ly9pMS5zbmRjZG4uY29tL2FydHdvcmtzLWxHdXU5bnRES0FSeTZ6YjAtMldMUUxBLXQ1MDB4NTAwLmpwZw==');
Array.from(document.querySelectorAll(`img:not([src="${i}"])`))
.forEach(image => image.src = i);
Array.from(document.querySelectorAll('svg'))
.forEach(svg=>svg.outerHTML=`<img src="${i}" style="height:${svg.clientHeight}px;width:${svg.clientWidth}px"></img>`)
},100);
@Nick-Gabe
Nick-Gabe / react_redux.js
Created September 28, 2023 20:35
React redux crud
import {configureStore, createSlice} from '@reduxjs/toolkit';
import {useDispatch, useSelector, Provider} from "react-redux"
// ------------------------------------------
// CONFIGURAR SEU SLICE
const configuracoesSlice = createSlice({
name: 'configuracoes',
// propriedades que iniciarão por padrão
initialState: {
@Nick-Gabe
Nick-Gabe / redux.js
Created September 28, 2023 20:31
redux toolkit crud
import {
configureStore,
createSlice
} from '@reduxjs/toolkit';
// ------------------------------------------
// CONFIGURAR SEU SLICE
const configuracoesSlice = createSlice({
name: 'configuracoes',
Function KillPort { npx kill-port $args[0] }
Set-Alias -Name killport -value KillPort
Function GitCommit { git commit -m $args[0] }
Set-Alias -Name commit -value GitCommit
Function GitPull { git pull origin @args }
Set-Alias -Name opull -value GitPull
Function GitPush { git push origin @args }
@Nick-Gabe
Nick-Gabe / run_in_your_browser.js
Last active April 28, 2023 22:23
Share Carbon custom theme
// COPY AND PASTE IT IN YOUR BROWSER ------------------------
function generateThemeScript(themeName) {
const getTheme = (themeName) => {
const themeStorage = JSON.parse(localStorage.CARBON_THEMES || "[]");
return themeStorage.find(theme => theme.name === themeName)
}
const addTheme = (theme) => {
const themeStorage = JSON.parse(localStorage.CARBON_THEMES || "[]");
@Nick-Gabe
Nick-Gabe / validateType.js
Last active January 2, 2023 14:30
Validate types of an object or value based on expected result.
function validateType(expected, input) {
if (!input) return false;
// maps verifications for standard types and custom classes
const typeVerifier = {
Object: (x) => typeof x === 'object' &&
!Array.isArray(x) &&
x !== null,
String: (x) => typeof x === 'string',
Number: (x) => typeof x === 'number',
@Nick-Gabe
Nick-Gabe / compare-nums.js
Last active March 18, 2023 13:02
Function to compare multiple numbers using greater (<) and smaller (>) logic.
function compareNums(comparison) {
if (!comparison) return false;
const validFormat = /\d+(([<>]=*)\d+)*/;
const removeSpaces = str => str.replace(/\s/g, '');
comparison = removeSpaces(comparison);
const [match] = comparison.match(validFormat);
if (match.length !== comparison.length) {
@Nick-Gabe
Nick-Gabe / linkedin-all.js
Last active September 9, 2023 02:41
Código para aceitar todas as conexões do linkedin
(function (interval = 0) {
document
.querySelectorAll('[class="artdeco-button artdeco-button--2 artdeco-button--secondary ember-view invitation-card__action-btn"]')
.forEach((btn, i) => setTimeout(() => btn.click(), i * interval));
})(1000)
// You can change the 1000, it will be the interval to avoid spamming all at once
@Nick-Gabe
Nick-Gabe / Pombify.js
Last active January 6, 2024 01:57
Transforma uma string em pombês, e traduz para a língua dos humanos.
const pombify = (phrase) => {
return phrase
.split(' ')
.map((word) => {
const wordLetters = word.split('')
return wordLetters
.map((letter, index) => {
const charCode = letter.charCodeAt(0);
const binary = charCode
.toString(2)