Skip to content

Instantly share code, notes, and snippets.

View iradofurioso's full-sized avatar
🧠
Make it work, Make it right, Make it fast

Carlos Eduardo iradofurioso

🧠
Make it work, Make it right, Make it fast
View GitHub Profile
@iradofurioso
iradofurioso / txt
Created May 30, 2019 19:53
Use VI to remove BOM | Utilizando o VI para remover BOM (Byte-order-mark)
vim my-file.txt
# On VIM just type the following command to remove BOM
:set nobomb
# Saving the file
:wq!
@iradofurioso
iradofurioso / txt
Created June 13, 2019 14:06
PHP Artisan Tinker crashing all the time on MacOS Mojave
Problem: PHP Artisan Tinker crashes from issuing any command and leaves no logs.
Solution:
According to developer's forum: https://github.com/bobthecow/psysh/issues/540#issuecomment-446480753 it is necessary to edit
the following file:
~/.config/psysh/config.php in case the file do not exist just create a new one vim ~/.config/psysh/config.php
Add the following content:
@iradofurioso
iradofurioso / php
Created June 14, 2019 22:16
Laravel - Security - Hiding image (or any other file with correct mime) real path
return response($myImagePath, 200)->header('Content-Type', 'image/jpeg');
@iradofurioso
iradofurioso / txt
Last active October 16, 2020 13:57
Avoid enter GITHUB password all the time when pushing | Evitar ficar digitando a senha do GITHUB toda hora
Para dar push ao Github sem precisar ficar digitando a senha a todo momento
$ ssh-keygen
→ Colocar o nome do arquivo com a chave pgp.
$ ssh-add
$ cat ~/.ssh/<nome_do_arquivo>.pub
copiar a chave e colocar no github na tela de configurações.
@iradofurioso
iradofurioso / php
Created June 15, 2019 23:49
Laravel: Removendo o prefixo '/api/' da URL | Removing /api/ prefix from URL
//File: app\Providers\RouterServiceProvider.php
// Removing prefix line | removendo a linha de prefixo
//Mudar | Change
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
@iradofurioso
iradofurioso / _ide_helper.php
Created June 16, 2019 01:25 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@iradofurioso
iradofurioso / shell
Created June 16, 2019 13:07
Limpa todos os arquivos de cache no Laravel | Clear all Laravel cache files
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan clear-compiled
php artisan config:cache
@iradofurioso
iradofurioso / sql
Last active December 30, 2019 19:01
MySQL or MariaDB dirty solution to set UUID column as default
-- Some say MySQL already support UUID() function as default, but old versions and MariaDB not!
-- In case you deal with various tables create trigger to insert UUID is not a good solution from
-- a manteinance point of view.
-- DISCLAIMER 1: For learning purposes only. It is NOT secure setting a fixed value for UUID due to obvious reasons.
-- DISCLAIMER 2: Use char to store UUID is not a wise solution the correct approach is to use BINARY(16). I will keep
-- the below solution just for very small apps.
CREATE TABLE 'tb_test' (
'id_test' INT NOT NULL AUTO_INCREMENT PRIMARY KEY
@iradofurioso
iradofurioso / sql
Created July 17, 2019 20:17
Find mysql.sock in use (the correct one)
-- An easy way to find which mysql.sock is being used and the path of it, simply log in into your mysql and run this command:
SHOW VARIABLES LIKE '%sock%';
@iradofurioso
iradofurioso / bash
Created July 17, 2019 20:26
OpenSUSE LEAP 15 - Set an snapshot as default
# After getting into the system from a snapshot, use the following command to set the snapshot
snapper rollback