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
@Nick-Gabe
Nick-Gabe / RabbitHole.js
Last active October 15, 2022 09:59
Code used to answer the Rabbit Hole challenge.
// tamanho do tabuleiro ao todo e quantas colunas tem em uma fileira
const boardSize = 500;
const holesPerRow = 50;
// tempo em ms de delay do intervalo do game loop
const loopDelay = 25;
// emojis, só pra deixar bonitinho kkkk
const emojis = {
blank: '🟫',
@Nick-Gabe
Nick-Gabe / numeroPorExtenso.js
Last active January 15, 2025 22:00
Um código que gera números por extenso
const pluralExtList = [
{
1: "um",
2: "dois",
3: "três",
4: "quatro",
5: "cinco",
6: "seis",
7: "sete",
8: "oito",
@Nick-Gabe
Nick-Gabe / roadmap.js
Created July 13, 2022 21:59
Roadmap feito por mim, uma rota básica que fiz pra quem quiser iniciar pelo Front End
const HTML = [
- estrutura de uma tag
- o que é head e body
- tags da head (meta, link, title... )
- cabeçalhos
- tags básicas (p, div, span, a, b, i, u, img)
- tag de estilo e script
- listas
- tabelas
- formulários e inputs
// quando o usuário inserir um número, executa:
// pega a linha e coluna com base no id
const line = Math.floor(this.id / 9)
const row = this.id % 9
// verifica se existe algum número igual a ele na vertical
const verifyVertical = board[line].includes(this.value)
// verifica se existe algum número igual a ele na horizontal
@Nick-Gabe
Nick-Gabe / setStyle.ts
Created June 23, 2022 23:52
Adds styles to a Html Element based on a CSS Object.
interface HTMLElement {
setStyle(newStyles: Partial<CSSStyleDeclaration>): void;
}
HTMLElement.prototype.setStyle = function (newStyles) {
for (let style in newStyles) {
this.style[style] = newStyles[style]!
}
}
@Nick-Gabe
Nick-Gabe / setStyle.js
Created June 23, 2022 23:51
Adds styles to a Html Element based on a CSS Object.
HTMLElement.prototype.setStyle = function (newStyles) {
for (let style in newStyles) {
this.style[style] = newStyles[style];
}
};
@Nick-Gabe
Nick-Gabe / string pagination.js
Last active June 21, 2022 13:44
Code to make pages out of strings
function getPages(base, maxChars, splitTerm = '\n') {
const pages = []
// generates an array of items based in the string
const contentItems = base.split(splitTerm)
let content = ''
for (let i = 0; i < contentItems.length; i++) {
let part = contentItems[i] + splitTerm
// if content + part will be more than the max chars allowed,
@Nick-Gabe
Nick-Gabe / catbot.js
Created April 2, 2022 14:26
Código pra mandar gatos pelo zap
const { default: axios } = require('axios');
const qrcode = require('qrcode-terminal');
const { Client, MessageMedia } = require('whatsapp-web.js');
const client = new Client();
client.on('qr', (qr) => {
// Generate and scan this code with your phone
qrcode.generate(qr, {small: true});
});