Skip to content

Instantly share code, notes, and snippets.

View ph7jack's full-sized avatar
🏠
Working from home

Pedro Oliveira ph7jack

🏠
Working from home
View GitHub Profile
@ph7jack
ph7jack / AppServiceProvider.php
Created August 17, 2021 14:12
Livewire Component Title macro
<?php
namespace App\Providers;
use App\Macros\ViewMacros;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View;
class AppServiceProvider extends ServiceProvider
{
Form.php
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Form extends Component
{
public ?string $name = 'pedro';
@ph7jack
ph7jack / manjaro-tallstack-setup
Last active August 17, 2021 11:58
Manjaro TallStack Setup
# Remove apps if not will use
k3b, konversation, thunderbird
# Add sudo password
sudo passwd root
# Set the fastest mirror
sudo pacman-mirrors --fasttrack
@ph7jack
ph7jack / formatar_cnpj_cpf.md
Created November 14, 2019 17:12 — 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);
  }