Skip to content

Instantly share code, notes, and snippets.

View mhef's full-sized avatar

Matheus mhef

View GitHub Profile
@mhef
mhef / validateCPF_CNPJ.js
Created May 4, 2020 12:38
Validar CPF e CNPJ - Javascript ES6
/**
@author github.com/mhef
*/
const validateCPF = (cpf) => {
if (cpf.length != 11) return false;
let expanded = [...cpf];
let expandedWC = expanded.slice(0,9); // without check digits
if(expanded.every(v => v == cpf[0])) return false; // fail if all numbers are equal
1. All elements of the $_SERVER array whose keys begin with 'HTTP_' come from HTTP request headers and are not to be trusted.
2. All HTTP headers sent to the script are made available through the $_SERVER array, with names prefixed by 'HTTP_'.
3. $_SERVER['PHP_SELF'] is dangerous if misused. If login.php/nearly_arbitrary_string is requested, $_SERVER['PHP_SELF'] will contain not just login.php, but the entire login.php/nearly_arbitrary_string. If you've printed $_SERVER['PHP_SELF'] as the value of the action attribute of your form tag without performing HTML encoding, an attacker can perform XSS attacks by offering users a link to your site such as this:
<a href='http://www.example.com/login.php/"><script type="text/javascript">...</script><span a="'>Example.com</a>
The javascript block would define an event handler function and bind it to the form's submit event. This event handler would load via an <img> tag an external file, with the submitted username and password as parameters.
@echo off
::made by github.com/mhef
title NoBugs Node.JS command prompt
echo .:oddmMMMMMMmdho/.
echo . yMMMMMMMMMMMMMMMMMmy/
echo .yMMy. .yMMMMMMMMMMMMMMMMMMMy.
echo .yMMMMMMy. .yhyooooyhmMMMMMMMMMMy.
echo /MMMMMMMMMMy. ./ymMMMMMMMM/
@mhef
mhef / estados-cidades.json
Created October 9, 2018 15:06 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",

NODEJS SQLITE3 - SOLUÇÃO DE PROBLEMAS (WINDOWS)

Caso ao rodar a aplicação em modo desenvolvimento (npm run dev) encontre o seguinte erro no Console:

Uncaught Error: Please install sqlite3 package manually

Será necessário construir pelo menos uma vez a aplicação para que o plugin nativo do SQLite3 seja compilado. Para construir:

$ npm run build