Skip to content

Instantly share code, notes, and snippets.

View GlauberF's full-sized avatar
🎯
Foco e determinação nos objetivos.

Glauber Funez GlauberF

🎯
Foco e determinação nos objetivos.
View GitHub Profile
@GlauberF
GlauberF / CountryCodes.php
Last active August 10, 2022 02:46
Country Codes
public function CountryCodes()
{
return [
array('id' => '1','code' => 'US','country' => 'USA','phone_name' => 'USA (+1)','phone_code' => '1'),
array('id' => '2','code' => 'DZ','country' => 'Algeria','phone_name' => 'Algeria (+213)','phone_code' => '213'),
array('id' => '3','code' => 'AD','country' => 'Andorra','phone_name' => 'Andorra (+376)','phone_code' => '376'),
array('id' => '4','code' => 'AO','country' => 'Angola','phone_name' => 'Angola (+244)','phone_code' => '244'),
array('id' => '5','code' => 'AI','country' => 'Anguilla','phone_name' => 'Anguilla (+1264)','phone_code' => '1264'),
array('id' => '6','code' => 'AG','country' => 'Antigua & Barbuda','phone_name' => 'Antigua & Barbuda (+1268)','phone_code' => '1268'),
array('id' => '7','code' => 'AR','country' => 'Argentina','phone_name' => 'Argentina (+54)','phone_code' => '54'),
@GlauberF
GlauberF / print-table.php
Last active July 22, 2022 17:08
simple piped data generator. #gerador_table_php
/**
* Table Print
* @example
* echo TablePrinter("|%-15.15s |%-35.35s | x |\n", ['Author', 'Description'], [['Gauber Funez', 'simple piped data generator']]);
*/
function TablePrint(string $mask, array $header, array $data): string {
if (!$mask) {
throw new Exception("Não foi enviado a Máscara | TablePrinter", 1);
}
<NFe xmlns="http://www.portalfiscal.inf.br/nfe"><infNFe Id="NFe42220708094055000110550020000000041422952024" versao="4.00"><ide><cUF>42</cUF><cNF>42295202</cNF><natOp>VENDA DE MERCADORIAS ADQUIRIDAS DE TERCEIROS</natOp><mod>55</mod><serie>2</serie><nNF>4</nNF><dhEmi>2022-07-21T09:23:38-03:00</dhEmi><dhSaiEnt>2022-07-21T18:38:24-03:00</dhSaiEnt><tpNF>1</tpNF><idDest>1</idDest><cMunFG>4204301</cMunFG><tpImp>1</tpImp><tpEmis>1</tpEmis><cDV>4</cDV><tpAmb>2</tpAmb><finNFe>1</finNFe><indFinal>1</indFinal><indPres>1</indPres><indIntermed>0</indIntermed><procEmi>0</procEmi><verProc>1000</verProc></ide><emit><CNPJ>08094055000110</CNPJ><xNome>P &amp; S CENTRO AUTOMOTIVO LTDA</xNome><xFant>PIT STOP AUTO CENTRO</xFant><enderEmit><xLgr>Rua Marechal Deodoro - de 917 a 1685 - lado impar</xLgr><nro>dsfsdf</nro><xBairro>Centro</xBairro><cMun>4204301</cMun><xMun>Concordia</xMun><UF>SC</UF><CEP>89700053</CEP><cPais>1058</cPais><xPais>Brasil</xPais><fone>554998165594</fone></enderEmit><IE>255227515</IE><IM>00022996</IM><CNAE>453
@GlauberF
GlauberF / nGram.js
Last active July 14, 2022 17:53
NGram
//////////////////////////////////////
// Example
// nGram(2)('Brasil');
/////////////////////////////////////
/**
* Factory returning a function that converts a value string to n-grams.
*
* @param {number} n
*/
@GlauberF
GlauberF / .htaccess
Created June 13, 2022 11:46 — forked from cyberwani/.htaccess
Block the HTTRACK using HTACCESS files
Options All -Indexes
# Ultimate htaccess Blacklist 2 from Perishable Press
# Deny domain access to spammers and other scumbags
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ADSARobot|ah-ha|almaden|aktuelles|Anarchie|amzn_assoc|ASPSeek|ASSORT|ATHENS|Atomz|attach|attache|autoemailspider|BackWeb|Bandit|BatchFTP|bdfetch|big.brother|BlackWidow|bmclient|Boston\ Project|BravoBrian\ SpiderEngine\ MarcoPolo|Bot\ mailto:[email protected]|Buddy|Bullseye|bumblebee|capture|CherryPicker|ChinaClaw|CICC|clipping|Collector|Copier|Crescent|Crescent\ Internet\ ToolPak|Custo|cyberalert|DA$|Deweb|diagem|Digger|Digimarc|DIIbot|DISCo|DISCo\ Pump|DISCoFinder|Download\ Demon|Download\ Wonder|Downloader|Drip|DSurf15a|DTS.Agent|EasyDL|eCatch|ecollector|efp@gmx\.net|Email\ Extractor|EirGrabber|email|EmailCollector|EmailSiphon|EmailWolf|Express\ WebPictures|ExtractorPro|EyeNetIE|FavOrg|fastlwspider|Favorites\ Sweeper|Fetch|FEZhead|FileHound|FlashGet\ WebWasher|FlickBot|fluffy|FrontPage|GalaxyBot|Generic|Getleft|GetRight|
@GlauberF
GlauberF / .php-cs-fixer.php
Created May 4, 2022 13:13 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@GlauberF
GlauberF / deepDiffObj.js
Last active March 16, 2022 13:37
deepDiffObj, Function to analyze two objects and return if there were changes, if there were not, if something was deleted etc.
const deepDiffMapper = function () {
return {
VALUE_CREATED: 'created',
VALUE_UPDATED: 'updated',
VALUE_DELETED: 'deleted',
VALUE_UNCHANGED: 'unchanged',
map: function (obj1, obj2) {
if (this.isFunction(obj1) || this.isFunction(obj2)) {
throw 'Invalid argument. Function given, object expected.';
}
[
{
"id":1 ,
"name":"page_count",
"type":"number",
"arrayItemType":"string",
"eval":false,
"nullable":false,
"pattern":"",
"expression":"",
@GlauberF
GlauberF / aggregate_mongo.js
Last active February 5, 2022 14:32
get real object in for_id_supplier
// Requires official MongoShell 3.6+
db = db.getSiblingDB("....");
db.getCollection("produtos").aggregate(
[
{
"$project" : {
"_id" : NumberInt(0),
"produtos" : "$$ROOT"
}
},
@GlauberF
GlauberF / optimize-css.gulpfile.js
Created January 26, 2022 12:39 — forked from subodhkumarWM/optimize-css.gulpfile.js
CSS optimization post Angular prod build
const gulp = require("gulp");
const filter = require("gulp-filter");
const purify = require("gulp-purify-css");
const gzip = require("gulp-gzip");
const brotli = require("gulp-brotli");
const clean = require("gulp-clean");
const { series, parallel } = require("gulp");
// #1 | Optimize CSS
/*