Skip to content

Instantly share code, notes, and snippets.

View tharlesamaro's full-sized avatar
Hello World!

Tharles Amaro tharlesamaro

Hello World!
View GitHub Profile
@tharlesamaro
tharlesamaro / git.md
Created November 26, 2021 12:41 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@tharlesamaro
tharlesamaro / KeyGenerateCommand.php
Created November 20, 2021 19:51 — forked from krisanalfa/KeyGenerateCommand.php
Lumen Key Generator Commands
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class KeyGenerateCommand extends Command
{
use ConfirmableTrait;
@tharlesamaro
tharlesamaro / mask.php
Created July 18, 2021 06:15 — forked from leonirlopes/mask.php
Máscara PHP para CNPJ, CPF, Data e qualquer outra coisa
<?php
// PHP Máscara CNPJ, CPF, Data e qualquer outra coisa
// http://blog.clares.com.br/php-mascara-cnpj-cpf-data-e-qualquer-outra-coisa/
// ver em funcionamento ~~> https://ideone.com/wP7zN2
function mask($val, $mask)
{
$maskared = '';
$k = 0;
@tharlesamaro
tharlesamaro / formatar_cnpj_cpf.md
Created August 19, 2019 02:11 — forked from davidalves1/formatar_cnpj_cpf.md
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === 11) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  }