Skip to content

Instantly share code, notes, and snippets.

View LaisGalvao's full-sized avatar
🍍
Are you ready, kids?

Laís Galvão LaisGalvao

🍍
Are you ready, kids?
View GitHub Profile
@LaisGalvao
LaisGalvao / helpers.js
Last active February 16, 2024 21:27
Helpers para diversas situações - Vue.js / JS
View helpers.js
// Função helper que faz adicionar query na url sem dar reload na página
addQueryParam (param) {
const currentQuery = { ...this.$route.query }
currentQuery.key = param
const newUrl = `${window.location.pathname}?${new URLSearchParams(currentQuery).toString()}`
// Use history.replaceState para alterar a URL sem recarregar o componente
window.history.replaceState({}, '', newUrl)
}
@LaisGalvao
LaisGalvao / reset.css
Created March 20, 2023 13:22 — forked from DavidWells/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
View reset.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
View How to save a webpage as PDF file using Puppeteer.js
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
path: 'url.pdf', // Saves pdf to disk.
format: 'A4',
@LaisGalvao
LaisGalvao / instagram-api_send_message.js
Created August 31, 2022 19:50 — forked from baptx/instagram-api_send_message.js
Instagram API: send direct messages from a web browser
View instagram-api_send_message.js
/*
Instagram API: send direct messages from a web browser
Since April 2020, Instagram has a web version to send and read direct messages so my Instagram scripts are not longer needed and I would not recommend using them unless you really need it, to avoid being banned
(never happened to me with Instagram but WhatsApp is owned by Facebook also and they did it to users registering from an unofficial app like yowsup: https://github.com/tgalal/yowsup/commit/88b8ad9581fa22dac330ee3a05fec4e485dfa634#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5)
For browser setup, see script instagram-api_direct_messages_backup.js
Instagram web version sessionid cookie does not allow sending messages so we need to log in manually
Signature should match signed_body data (using HMAC-SHA256 with private key) but wrong signature or key may work also.
@LaisGalvao
LaisGalvao / semantic-commit.txt
Created July 28, 2022 13:03 — forked from eltonea/semantic-commit.txt
Exemplos de commit semântico
View semantic-commit.txt
chore: add Oyster build script //Pequenas alterações que não são novas funcionalidades.
docs: explain hat wobble //Semelhante a uma wiki; documentações etc.
feat: add beta sequence //Criação de Nova funcionalidade;
fix: remove error message //Correção de bugs
refactor: share logic 4d3d3d3 //Refatoração de um código
style: convert tabs to spaces //Alteração em estilos, formatação de código etc.
test: ensure that increment //Criação de testes da sua aplicação
@LaisGalvao
LaisGalvao / deploy.sh
Created July 26, 2022 16:10 — forked from vlucas/deploy.sh
Deploy a Static Site to Github Pages
View deploy.sh
#!/bin/bash
GIT_REPO_URL=$(git config --get remote.origin.url)
mkdir .deploy
cp -R ./* .deploy
cd .deploy
git init .
git remote add github $GIT_REPO_URL
git checkout -b gh-pages
git add .
@LaisGalvao
LaisGalvao / deploy.sh
Created July 26, 2022 16:10 — forked from sam-ngu/deploy.sh
Bash script to deploy a React app to Github pages
View deploy.sh
#!/usr/bin/env sh
# abort on errors
set -e
# build
npm run build
# navigate into the build output directory
cd build
@LaisGalvao
LaisGalvao / purgecss.js
Created May 6, 2022 17:06 — forked from dekadentno/purgecss.js
Vue CLI 3 + PurgeCSS
View purgecss.js
/**
1) npm i -D purgecss @fullhuman/postcss-purgecss purgecss-webpack-plugin glob-all path
2) edit vue.config.js
*/
/**
** vue.config.js
*/
const PurgecssPlugin = require('purgecss-webpack-plugin');
const glob = require('glob-all');
@LaisGalvao
LaisGalvao / index.html
Created April 28, 2022 15:56
Exemplo prático - Artigo Introdução ao Javascript
View index.html
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Oficina Javascript</title>
@LaisGalvao
LaisGalvao / meta-tags.md
Created April 27, 2022 16:05 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags
View meta-tags.md

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>