Skip to content

Instantly share code, notes, and snippets.

View IgorDePaula's full-sized avatar
😆

Igor C. de Paula IgorDePaula

😆
View GitHub Profile
@IgorDePaula
IgorDePaula / LaravelWhereLikeMacro.php
Created November 26, 2023 13:15 — forked from MrPunyapal/LaravelWhereLikeMacro.php
Laravel Custom 'whereLike' Macro for Dynamic 'LIKE' Searches including relationships
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
class AppServiceProvider extends ServiceProvider
{
// ...
@IgorDePaula
IgorDePaula / post-receive.sh
Created October 21, 2023 17:33 — forked from lfalmeida/post-receive.sh
Hook post receive com push options
#!/bin/sh
# ---- Config
ENV_NAME="Homologação"
TAG_SUFFIX="homolog"
PROJECT_NAME="Scania Journey Event"
PROJECT_PATH_HOST="/home/lfalmeida/Projects/GitHooks/prod/"
PROJECT_PATH_DOCKER="/src/projeto"
SLACK_WEBHOOK=""
ENABLE_SLACK_POST=0
@IgorDePaula
IgorDePaula / index.html
Created September 25, 2023 15:00
js troca pai pelo filho
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="card">
card 1 &nbsp;
openssl genrsa 2048 > private.pem
openssl req -x509 -new -key private.pem -out public.pem
openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx
@IgorDePaula
IgorDePaula / index.php
Created July 24, 2023 16:00
Hydrator usando Visitor pattern
<?php
interface Visitor {
public function visit(Visitable $visitable);
}
interface Visitable {
public function accept(Visitor $visitor);
}
class Visitante implements Visitor {
@IgorDePaula
IgorDePaula / git-reset-author.sh
Created May 11, 2023 13:39 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
#!/bin/bash
TARGET="/var/www/"
GIT_DIR="/home/git/laravel.git"
BRANCH="master"
GREEN='\033[0;32m' # green, in true
NC='\033[0m' # No Color
BLUE='\033[0;34m'
while read oldrev newrev ref
@IgorDePaula
IgorDePaula / Esconder_console_log.md
Created March 15, 2023 02:01 — forked from romuloctba/Esconder_console_log.md
Esconder console.log() quando o site for para produção

Esconder console.log() para o site em produção

  • Trocar o www.mywebsite.com pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().

@IgorDePaula
IgorDePaula / example_baileys.js
Created March 13, 2023 13:25 — forked from BlackAmda/example_baileys.js
This is a JavaScript example source code of baileys repo example.ts code(https://github.com/adiwajshing/Baileys/blob/master/Example/example.ts).
const { Boom } = require('@hapi/boom')
const { default: makeWASocket, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, makeCacheableSignalKeyStore, makeInMemoryStore, useMultiFileAuthState } = require('@adiwajshing/baileys')
const P = require("pino");
let MAIN_LOGGER = P({ timestamp: () => `,"time":"${new Date().toJSON()}"` });
const logger = MAIN_LOGGER.child({});
logger.level = 'trace'
const useStore = !process.argv.includes('--no-store')
const doReplies = !process.argv.includes('--no-reply')
@IgorDePaula
IgorDePaula / Attributes.php
Created March 7, 2023 23:26
Atributo com php
<?php
#[Attribute]
class Validacao {
public function __construct(
public string $regra,
public int $valor
){}
public function validate(int $value)