Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / magento-2-enable-error-and-exception-log.md
Last active September 27, 2022 22:41
Enable error and exception logging in Magento2

Step 1

Inside pub/errors folder, rename local.xml.sample to local.xml.

Step 2

Uncomment ini_set('display_errors', 1); on app/bootstrap.php file.

More info

@luizventurote
luizventurote / wp-dropdown-menu-of-categories.php
Last active September 25, 2021 21:59
Dropdown menu of categories with Walker.
<?php
# Walker Class
class my_Walker_CategoryDropdown extends Walker_CategoryDropdown {
function start_el(&$output, $category, $depth, $args) {
$pad = str_repeat('&nbsp;', $depth * 3);
$cat_name = apply_filters('list_cats', $category->name, $category);
@luizventurote
luizventurote / install-php-extensions-mamp-pro-4.md
Created August 12, 2017 05:27
Install custom PHP extensions for MAMP PRO 4

Install custom PHP extensions for MAMP PRO 4

Example extension: gmp on a MAMP PRO with PHP 5.6.27 installation. For other versions it's just replacing the php version in the paths. Steps below are tested on MacOS Sierra (10.12.2).

Prerequisites

Install Brew and MAMP PRO.

@luizventurote
luizventurote / valet-sample-magento.sh
Last active December 4, 2019 08:38
Bash script to install a Magento store with sample data automatically using Valet Plus and n98-magerun.
#!/usr/bin/env bash
folderName=${PWD##*/}
magentoUser="MAGENTO_PUBLIC_KEY"
magentoPassword="MAGENTO_SECRET_KEY"
n98-magerun2.phar install --dbHost="localhost" --dbUser="root" --dbPass="root" --dbName="${folderName}" --installationFolder="magento-folder" --installSampleData=yes --baseUrl="http://${folderName}.test/"
mv magento-folder/* .
@luizventurote
luizventurote / instagram_api.php
Created September 12, 2016 22:01 — forked from arturmamedov/instagram_api.php
Instagram API retrive access token with PHP curl
<?php
// yo can follow this guide to http://www.benrlodge.com/blog/post/how-to-generate-an-instagram-access-token#
#1 first you need to create a Client in Instgram Developer Dashboard
// https://www.instagram.com/developer/clients/manage/
#2 after you need to retrive a oAuth code for after get access_token
// https://www.instagram.com/developer/authentication/
// change the params with your one and open link in browser
@luizventurote
luizventurote / m2theme.sh
Last active August 29, 2019 17:46
Bash script to deploy Magento 2 theme static content.
#!/usr/bin/env bash
echo "M2 - Deploy Static Content $1/$2 🚀"
rm -rf var/view_preprocessed/pub/static/frontend/$1/$2
rm -rf var/view_preprocessed/source/frontend/$1/$2
grunt exec:$2
@luizventurote
luizventurote / fix-header-script.js
Last active April 5, 2018 13:25
Javascript code to fix the header in the top.
jQuery(function($){
var header = document.querySelector('header.page-header .header.content'),
panel = document.querySelector('header.page-header .panel'),
$panel = jQuery(panel),
$header = jQuery(header),
headerContainer = document.querySelector('header.page-header'),
$headerContainer = jQuery(headerContainer),
lastScroll = 0,
upSign = -1,
@luizventurote
luizventurote / magento1-layout-cms.xml
Created March 2, 2018 16:28
Add head text by on a CMS page - Magento 1
<reference name="head">
<block type="core/text" name="custom_css">
<action method="setText">
<text><![CDATA[
<style type="text/css">
@luizventurote
luizventurote / backup-mysql-database.md
Last active February 16, 2018 22:06
Backup MySql database

Using n9m-Magerun for Magento

When you guys create a local dev environment, run this command to create database backup:

n98-magerun db:dump --strip='@development' --stdout | gzip > site-type-$(date +%Y%m%d%H%M%S).sql.gz

Replace “site" with the name of the site that you are backing up and “type" with either “prod”, “dev”, or “stage”.

MySql Dump