Skip to content

Instantly share code, notes, and snippets.

View tiagosampaio's full-sized avatar
🎯
Focusing

Tiago Sampaio tiagosampaio

🎯
Focusing
View GitHub Profile
@tiagosampaio
tiagosampaio / Customer.php
Last active December 5, 2017 00:27
Code Example Customer Model in Magento 1.9.3.1
<?php
/**
* Authenticate customer
*
* @param string $login
* @param string $password
* @throws Mage_Core_Exception
* @return true
*
@tiagosampaio
tiagosampaio / Customer.php
Created December 5, 2017 00:28
Code Example Customer Model in Magento 2
<?php
/**
* Authenticate customer
*
* @param string $login
* @param string $password
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
* Use \Magento\Customer\Api\AccountManagementInterface::authenticate
@tiagosampaio
tiagosampaio / starulm.md
Created January 23, 2019 16:11 — forked from DrYazid/starulm.md
StarUml 3.0 full version

StarUML 3.0

  • 1- install staruml. : staruml
  • 2- install node.js : node.js
  • 3- go to ...\AppData\Local\Programs\StarUML\resources
  • 4- open CMD As admin
  • 5- execute
@tiagosampaio
tiagosampaio / destroy.sh
Last active August 2, 2020 23:34
Valet+ Destroy
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
@tiagosampaio
tiagosampaio / README.md
Created March 3, 2021 13:46 — forked from leek/_Magento2_DeleteTestData.md
Magento 2 - Delete All Test Data

These set of scripts are for Magento 2. For Magento 1, see this Gist.

@tiagosampaio
tiagosampaio / difference.md
Last active February 13, 2024 15:28
PHP: Ternary Operator vs Null Coalescing Operator

Ternary Operator vs Null Coalescing Operator in PHP

?: (Elvis Operator)

The elvis operator (?:) is actually a name used for shorthand ternary (which was introduced in PHP 5.3). It has the following syntax:

// PHP 5.3+
expr1 ?: expr2;
@tiagosampaio
tiagosampaio / README.md
Last active May 22, 2024 20:05
MySQL: Operations Cheat Sheet

MySQL Operations Cheat Sheet

Making backup all databases:

mysqldump -u user -p --all-databases > dump.sql

Making backup only one database:

Remove DEFINER clause from MySQL Dumps

sed -i 's/DEFINER=[^*]*\*/\*/g' mydump.sql

In macOS:

sed -i '' 's/DEFINER=[^*]*\*/\*/g' mydump.sql
@tiagosampaio
tiagosampaio / README.md
Created January 7, 2022 23:41
Upgrade Your SSH Key to Ed25519

Upgrade Your SSH Key to Ed25519

If you’re a DevOps engineer or a web developer, there’s a good chance that you’re already familiar and using the SSH key authentication on a daily basis. Whether it’s for logging into the remote server or when pushing your commit to the remote repository. It provides us with better security than the traditional password-based authentication.

But, when is the last time you created or upgraded your SSH key? And did you use the latest recommended public-key algorithm? If it was more than five years ago and you generated your SSH key with the default options, you probably ended up using RSA algorithm with key-size less than 2048 bits long.

Check Available SSH Keys on Your Computer

To check all available SSH keys on your computer, run the following command on your terminal:

@tiagosampaio
tiagosampaio / README.md
Last active January 24, 2022 17:27
Setup Source Guardian for PHP

Setup Source Guardian for PHP

Run the following commands to install SourceGuardian Loader

PHP 7.2

sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian