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 / sql
Created October 3, 2019 14:00
Disable foreign key constraint in MySQL temporarily
-- Before running queries
SET FOREIGN_KEY_CHECKS=0;
-- RUN ALL QUERIES
-- Then return back to default
SET FOREIGN_KEY_CHECKS=1;
@iradofurioso
iradofurioso / ts
Created August 12, 2019 21:24
Updating Current URL in Angular 7 Apps | Pretty URL | Friendly URL
// import location
import {Location} from '@angular/common';
// add in constructor
private location: Location
//Updating current url
this.location.replaceState(`/my/url/${this.code}/${this.id}`);
@iradofurioso
iradofurioso / txt
Created August 10, 2019 01:01
PHPStorm Rename Shortcut
For some reason PHPStorm 2019 file dialog do not show rename option, at least on MacOS. To rename a file you have to use your keyboard shortcut:
FN+SHIFT+F6
@iradofurioso
iradofurioso / txt
Created August 3, 2019 16:16
Disable spell check WebStorm or PHPStorm - Desativar verificação ortográfica
Windows
File | Default Settings | Editor | Inspections | Spelling
MacOS
WebStorm | Preferences | Editor | Inspections | Spelling
@iradofurioso
iradofurioso / txt
Created July 22, 2019 14:05
Get rid of webpack-dev-server status bar
To get rid of webpack-dev-server status bar when compiling Angular script there is an easy solution. No change in configuration is ncessary.
When running ng serve it will give the following link http://localhost:4200/webpack-dev-server/
Just remove the last part of it "webpack-dev-server/"
BANG! no status bar. Problem solved!
@iradofurioso
iradofurioso / bash
Created July 18, 2019 12:36
Como atualizar o VisualCode no OpenSUSE LEAP
# Primeira coisa a ser feita (caso não tenha feito ainda) é rodar os três comandos abaixo:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo'
sudo zypper refresh
# Depois rodar o comando que vai atualizar o pacote
@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
@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 / 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 / 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