Skip to content

Instantly share code, notes, and snippets.

Rafael Corrêa Gomes rafaelstz

View GitHub Profile
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 Apr 20, 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
@rafaelstz
rafaelstz / auth.json
Last active Nov 10, 2017
Magento2 Auth.json
View auth.json
{"http-basic": {"repo.magento.com": {"username":"4663362708601ec0c460a36edf59c70d","password":"f30b05a56f3b06d8b134ef93da73be5e"}}}
@rafaelstz
rafaelstz / magento2-truncate.sql
Created Aug 29, 2017
Magento 2 truncate customers, products, reviews and orders table
View magento2-truncate.sql
SET FOREIGN_KEY_CHECKS = 0;
-- Truncate order tables
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
@rafaelstz
rafaelstz / Robots.txt
Last active Nov 6, 2018
Robots.txt Magento 2
View Robots.txt
# Directories & files
Disallow: /wishlist/
Disallow: /customer/
Disallow: /checkout/
Disallow: /catalog/
Disallow: /catalogsearch/
Disallow: /downloader/
Disallow: /braintree/
Disallow: /order/
Disallow: /rma/
You can’t perform that action at this time.