Skip to content

Instantly share code, notes, and snippets.

View phaelfp's full-sized avatar

Raphael Freitas Pereira phaelfp

View GitHub Profile
@phaelfp
phaelfp / magento-2-debugging-tricks-setdata-dataobject-php-and-xdebug.php Magento 2 Debugging Tricks - setData, DataObject.php & xDebug by Matheus Gontijo
Magento 2 Debugging Tricks - setData, DataObject.php & xDebug by Matheus Gontijo
Video: https://www.youtube.com/watch?v=eo8N7e9eEPI
-----------------------------------------------
What is "stripos"?
<?php
// https://www.php.net/stripos
@phaelfp
phaelfp / mysql-docker.sh
Created May 17, 2019 13:08 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@phaelfp
phaelfp / M2 acl.xml
Created March 29, 2019 22:39 — forked from Vinai/M2 acl.xml
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
@phaelfp
phaelfp / git-deployment.md
Created September 11, 2018 18:18 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@phaelfp
phaelfp / Dockerfile
Created August 2, 2018 14:08 — forked from alkrauss48/Dockerfile
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@phaelfp
phaelfp / magento-address-autocomplete.js
Created July 27, 2018 11:17 — forked from rafaelpatro/magento-address-autocomplete.js
Magento Address Auto Fill based on Postcode
/**
* Address Auto Fill based on Postcode
*
* Author:
* Rafael Patro <[email protected]>
*
* Intallation:
* Add a CMS Static Block applying the entire script below.
* Add a Widget to pages with address forms.
*
@phaelfp
phaelfp / git-update-fork.sh
Created June 12, 2018 10:48 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@phaelfp
phaelfp / magento_increment_id.sql
Created March 2, 2018 14:34 — forked from gabidavila/magento_increment_id.sql
Alterar numeração de um pedido no Magento / Change Increment ID Magento
UPDATE eav_entity_store
SET increment_last_id = '100180000'
WHERE
entity_store_id = 1
@phaelfp
phaelfp / Vagrantfile
Created March 17, 2016 15:25
Vagrantfile e bootstrap.sh para subir um Ubuntu com MongoDB já configurado para acesso externo em ambiente de desenvolvimento.
IP = "10.0.33.34"
Vagrant.configure("2") do |config|
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :private_network, :ip => IP