Skip to content

Instantly share code, notes, and snippets.

View MarceloZapatta's full-sized avatar
🍃

Marcelo Zapatta MarceloZapatta

🍃
View GitHub Profile
@MarceloZapatta
MarceloZapatta / gist:2f5e031b64263ab7cb4611caac88e91d
Created October 4, 2024 23:09
Laravel Sail fix permissions
1. Build with sail
./vendor/bin/sail up -d
2. Enter the shell and change the owner
./vendor/bin/sail root-shell
cd ..
chown -R sail:sail html
@MarceloZapatta
MarceloZapatta / Install bash git autocomplete
Created November 26, 2020 12:28
How to install git auto complete
https://pagepro.co/blog/autocomplete-git-commands-and-branch-names-in-terminal/
@MarceloZapatta
MarceloZapatta / stripaccents.php
Last active November 25, 2020 13:25
stripaccents PHP
function stripAccents(string $string)
{
$replaceArray = [
'Š' => 'S',
'š' => 's',
'Đ' => 'Dj',
'đ' => 'dj',
'Ž' => 'Z',
'ž' => 'z',
'Č' => 'C',
@MarceloZapatta
MarceloZapatta / gist:f9367f16f057dcc999d3d98a54acb12c
Created September 14, 2020 13:35
Regex Validação hora formato 24horas
Regex para validação de horário formato 24horas HH:MM
(^[0-1]\d\:[0-5]\d$)|(^[2][0-4]\:[0-5]\d$)
@MarceloZapatta
MarceloZapatta / fix-git-slow.md
Last active May 12, 2020 16:55
Fix slow git SSH in linux
# Delete a local branch
git branch -D <branch>
# Delete remote branch
git push <origin> --delete <branch>
# https://stackoverflow.com/questions/2411031/how-do-i-clone-into-a-non-empty-directory
# Thanks: cmcginty, RichardC
git init
git remote add origin PATH/TO/REPO
git fetch
git reset origin/master # Required when the versioned files existed in path before "git init" of this repo.
git checkout -t origin/master
# If "git checkout -t origin/master" falls to "master already exists"
@MarceloZapatta
MarceloZapatta / chrome-without-security.md
Last active September 16, 2021 20:00
Run Google Chrome without CORS enabled Windows

On Windows

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --disable-gpu --user-data-dir=~/chromeTemp

On MacOS

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security

On Linux (chromium / chrome)

@MarceloZapatta
MarceloZapatta / put-presigned-url.php
Created November 18, 2019 16:33
Generate a presigned URL for AWS S3 Signature V2 aws/aws-sdk-php v2.8.24
<?php
/**
* Describes how to gerenate a presigned URL to upload a object to S3
* aws/aws-sdk-php v2.8.24
*/
define('AWS_KEY', 'ACCESS_KEY');
define('AWS_SECRET_KEY', 'SECRET_KEY');
define('AWS_HOST', 'HOST');
$bucket = 'presigned';
@MarceloZapatta
MarceloZapatta / datetime
Created September 9, 2019 17:55
Regex for datetime Brazil format
// 24/12/1999 15:59
^(0[1-9]|[12][0-9]|3[01])\/(0[0-9]|1[0-2])\/[1-9][0-9]{3} ([0-1][0-9]|2[0-4])\:([0-5][0-9])$