Skip to content

Instantly share code, notes, and snippets.

View thiagoszbarros's full-sized avatar
🎯
Focusing

Thiago Barros thiagoszbarros

🎯
Focusing
View GitHub Profile
@thiagoszbarros
thiagoszbarros / gist:f87d44e68981010bc3fa116bce72f70b
Created February 7, 2024 11:48
script para alterar email do autor dos commits git
#!/bin/bash
OLD_EMAIL="oldmail@email.com"
NEW_EMAIL="newmail@email.com"
# Verify that the old email exists in the commit history
if git log --all --grep="$OLD_EMAIL" --author="$OLD_EMAIL" --oneline --quiet; then
# Rewrite the Git history
git filter-branch --env-filter "
if [ \"\$GIT_AUTHOR_EMAIL\" = \"$OLD_EMAIL\" ]; then
@thiagoszbarros
thiagoszbarros / .bashrc
Created September 19, 2023 17:12
~/.bashrc
eval "$(oh-my-posh init bash)"
eval "$(oh-my-posh init bash --config $HOME/.cache/oh-my-posh/themes/json.omp.json)"
@thiagoszbarros
thiagoszbarros / docker-compose-build-sem-cache.md
Last active January 28, 2023 01:54
Como buildar um docker-compose.yml ignorando o cache de builds anteriores

docker-compose build --no-cache

@thiagoszbarros
thiagoszbarros / Response.php
Created December 9, 2022 12:57 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@thiagoszbarros
thiagoszbarros / TesouroDireto.gs
Created September 14, 2022 18:15 — forked from danperrout/TesouroDireto.gs
API Função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto.
* Fonte: https://www.tesourodireto.com.br/titulos/precos-e-taxas.htm
**/
function TESOURODIRETO(bondName, argumento="r") {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsondata = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsondata.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {
DROP TABLE IF EXISTS TB_HEROIS;
CREATE TABLE TB_HEROIS (
ID INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL,
NOME TEXT NOT NULL,
PODER TEXT NOT NULL
)
--create
INSERT INTO TB_HEROIS (NOME, PODER)
VALUES
@thiagoszbarros
thiagoszbarros / sync_primary_postgres.md
Last active August 3, 2022 22:49
O que fazer quando a sequencia de id não está sincronizada com o valor da primarykey no postgres?

O que fazer quando a sequencia de id não está sincronizada com o valor da primarykey no postgres?

Crie uma migration com o seguinte metodo up:

    public function up()
      {
          DB::statement("SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));");
      }
@thiagoszbarros
thiagoszbarros / gist_sobre_observer.md
Last active January 25, 2023 15:05
Métodos Updating/Updated e Deleting/Deleted não funcionam no Observer?

Métodos Updating/Updated e Deleting/Deleted não funcionam no Observer?

https://laravel.com/docs/8.x/eloquent#observers

Por padrão, quando realizamos alterações em massa em um model via eloquent, nenhum evento será disparado para os models afetados. Basicamente significa utilizar o where('xpto', $xpto) para encontrar registros no banco de dados. Mesmo que via de regra utilizemos o where() para encontrar um id, o eloquent não vai disparar eventos.

P: O que fazer fazer para resolver?

@thiagoszbarros
thiagoszbarros / GitCommitEmoji.md
Last active July 1, 2022 22:38 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji

URL

Uniform Resource Locator

Identify the host where the resource is located. ex: github.com

URN

Uniform resouce Name