Skip to content

Instantly share code, notes, and snippets.

View websterl3o's full-sized avatar

Leonardo Webster. R. Silva websterl3o

View GitHub Profile
@websterl3o
websterl3o / cloudSettings
Last active February 23, 2021 19:03 — forked from leocomelli/git.md
Lista de comandos úteis do GIT
{"lastUpload":"2021-02-23T19:03:23.194Z","extensionVersion":"v3.4.3"}
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
@websterl3o
websterl3o / .zshrc
Last active February 12, 2021 13:14
Mudar php sem dor de cabeça
function clear_config_php() {
rm ~/.config/valet/valet.sock
valet restart
}
function mudaphp () {
valet use php@$2 --force
brew link php@$2 --force
zshreload
composer global update
@websterl3o
websterl3o / TestUnitario.md
Created September 26, 2022 17:41
Como fazer um teste unitário

Pensei muito na melhor forma de fazer um teste unitário de uma funcionalidade "maior" e cheguei a uma ideia de como montar.

Suponto que eu estou trabalhando um serviço de consolidação de comissão, nesse serviço decidimos manter a consolidação de comissão como uma função que faz parte do serviço de comissão, mas para automatizar essa consolidação criamos um comando que executara de tempo em tempo que criara um Job que sera realizado para consolidar a comissão. 

Nessa comissão temos algumas configurações "payment_method", "blocked", "paid_at", "expected_date", "released_at", para criar o Job temos algumas regras, buscamos as comissões pelo metodo de "payment_method", que não esteja "blocked", que esteja "paid_at", que não esteja "released_at" e que a data "expected_date" seja menor ou igual a atual.

Esse job para consolidar a comissão precisa verificar se a comissão está "blocked", pois existem outros eventos que podem ocorrer que deixem a comissão bloqueado e comparar o dia atual com a data de pagamentos pa

@websterl3o
websterl3o / composer-install-vcs.md
Last active September 28, 2022 19:17 — forked from yidas/composer-install-vcs.md
Instalando pacote do composer via VCS

Instalando pacote do composer via VCS

1. Criar composer.json:

{
    "repositories": [                                             
        {                                                         
            "type": "vcs",                                        
 "url": "https://github.com/name/lib-name"
@websterl3o
websterl3o / Integração com EmailListVerify-Integration with EmailListVerify.php
Created September 29, 2022 11:40
Integração com EmailListVerify/Integration with EmailListVerify - PT-BR Esse código é um teste de integração com o EmailListVerify, onde ele verifica o e-mail e retorna se ele é valido. - EN This code is an integration test with EmailListVerify, where it checks the email and returns if it is valid.
<?php
try {
$listResults = [
'ok', // All is OK. The server is saying that it is ready to receive a letter to,this address, and no tricks have been detected
'error', // The server is saying that delivery failed, but no information about,the email exists
'smtp_error', // The SMTP answer from the server is invalid or the destination server,reported an internal error to us
'smtp_protocol', // The destination server allowed us to connect but the SMTP,session was closed before the email was verified
'unknown_email', // The server said that the delivery failed and that the email address does,not exist
'attempt_rejected', // The delivery failed; the reason is similar to “rejected”
@websterl3o
websterl3o / Integração com ElasticEmail-Integration with ElasticEmail.php
Created September 29, 2022 11:47
Integração com ElasticEmail/Integration with ElasticEmail PT-BR Esse código é um teste de integração com o ElasticEmail, onde ele verifica o e-mail e retorna se ele é valido. EN This code is an integration test with ElasticEmail, where it checks the email and returns if it is valid.
<?php
use ElasticEmail\Api\VerificationsApi;
use ElasticEmail\Configuration;
// API com elastic email validation https://app.elasticemail.com
$client = new \GuzzleHttp\Client();
$apiKey = '5BD30809F3075185B5F57D0913273A4C65ACC112E0D9DCBBB7670E5F45567D7CBE05AC53B8D1B81F7B073CC5B71C133B';
@websterl3o
websterl3o / laravel_conditional_index_migration.php
Created October 13, 2022 12:34 — forked from Razoxane/laravel_conditional_index_migration.php
Laravel - Create Index If Not Exists / Drop Index If Exists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class LaravelConditionalIndexMigration extends Migration
{
/**
* Run the migrations.
{
"editor.fontSize": 18,
"workbench.editor.highlightModifiedTabs": true,
"files.trimFinalNewlines": true,
"editor.fontFamily": "Fira Code",
// "terminal.integrated.fontFamily": "FiraCode Nerd Font",
"terminal.integrated.fontFamily": "MesloLGS NF",
"editor.fontLigatures": true,
"editor.lineHeight": 30,
"workbench.iconTheme": "material-icon-theme",

Terminal Bash, Zsh e Tinker

Otimização de tempo e produtividade


O que é Shell?

Shell é um programa que permite a comunicação entre o usuário e o computador.