Skip to content

Instantly share code, notes, and snippets.

Rafael Corrêa Gomes rafaelstz

Block or report user

Report or block rafaelstz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rafaelstz
rafaelstz / valet-plus-destroy
Created Jun 4, 2019 — forked from dannygsmith/valet-plus-destroy
Remove valet-plus - reboot required
View valet-plus-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'
@rafaelstz
rafaelstz / Magento 2 - Remove all customer data
Last active May 21, 2019
Remove all Magento 2 test Sample Data
View Magento 2 - Remove all customer data
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;
TRUNCATE TABLE `customer_entity_decimal`;
TRUNCATE TABLE `customer_entity_int`;
TRUNCATE TABLE `customer_entity_text`;
TRUNCATE TABLE `customer_entity_varchar`;
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
View top-modules-magento2.md

Top modules for Magento 2

I update this page to have the top Magento 2 modules for performance, development, ux and more.

Performance

Check the store performance tips in an admin panel dashboard

https://github.com/magehost/performance-dashboard

View autocompletar-cep.js
jQuery(function($){
//////////////////////////////////////////////////////
function limpa_formulário_cep() {
// Limpa valores do formulário de cep.
$("#billing\\:street1").val("");
$("#billing\\:city").val("");
$("#billing\\:region_id").val("");
}
View Useful-git-commands
### Show the last commits since the last merge
git log $(git merge-base --octopus $(git log -1 --merges --pretty=format:%P)).. --boundary
### Show all the files changed since the last merge via git diff
git diff --cc $M $M^1 $M^2 $(git merge-base $M^1 $M^2)
View optimize.sh
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@rafaelstz
rafaelstz / GrumPHP-Magento2.md
Last active Apr 17, 2019
Configure GrumPHP in your Magento 2 to check: Composer, PHPCS, PHPMD, PHPCSFixer, PHPCPD, PHPLint, Security Checker, XML Lint.
View GrumPHP-Magento2.md

Install GrumPHP in your Magento 2

Create the grumphp.yml in the root folder of your project and run these commands below:

composer require --dev symfony/dependency-injection '~3.3.0' --no-update
composer require --dev symfony/yaml '~3.3.0' --no-update
composer require --dev phpro/grumphp --no-update
composer require --dev jakub-onderka/php-parallel-lint --no-update
composer require --dev sebastian/phpcpd --no-update
composer update -vvvv
@rafaelstz
rafaelstz / 1step-Install-Deployer-Magento2-BitbucketPipelines.md
Last active Jun 23, 2019
Preparing the integration between Magento 2 + Bitbucket Pipelines + Deployer
View 1step-Install-Deployer-Magento2-BitbucketPipelines.md

Use both files in your root folder and run:

curl -LO https://deployer.org/deployer.phar && sudo mv deployer.phar /usr/local/bin/dep && sudo chmod +x /usr/local/bin/dep
composer require deployer/recipes --dev
composer require rafaelstz/deployer-magento2 dev-master --dev
@rafaelstz
rafaelstz / env.php
Last active Jan 16, 2018
Magento 2 Env.php configuration file by Platform.sh
View env.php
<?php
return array (
'backend' =>
array (
'frontName' => 'admin',
),
'crypt' =>
array (
'key' => '2c4f7c9688dc808fe2e23935f7eeb255',
),
@rafaelstz
rafaelstz / SQL_Orders_Sales_Customers_Report.sql
Created Nov 6, 2017
Magento 1 - SQL to get the each customer sales and orders total
View SQL_Orders_Sales_Customers_Report.sql
# Get the each customer sales and orders total
SELECT
-- Round to two decimal places and prepend with $
CONCAT('$', FORMAT(SUM(sales_flat_order.`grand_total`), 2)) AS 'Lifetime Sales',
COUNT(sales_flat_order.entity_id) AS 'Orders',
customer_entity.email AS 'Email',
MAX(sales_flat_order.created_at) AS 'Most Recent Order Date'
FROM `customer_entity`
LEFT JOIN sales_flat_order ON customer_entity.entity_id = sales_flat_order.customer_id
You can’t perform that action at this time.