Skip to content

Instantly share code, notes, and snippets.

View phaelfp's full-sized avatar

Raphael Freitas Pereira phaelfp

View GitHub Profile
@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
Cartão
Authorization
<= $ 1.050,00 -> Authorized
>= $ 1.050,01 && < $ 1.051,71 -> Timeout
>= $ 1.500,00 -> Not Authorized
Capture
<= $ 1.050,00 -> Captured
>= $ 1.050,01 -> Not Captured
Cancellation
@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
# Using Component Grovy
import org.scribe.builder.ServiceBuilder;
import org.scribe.model.*;
import org.scribe.oauth.OAuthService;
import java.util.Scanner;
import org.scribe.oauth.*;
OAuthService service = new ServiceBuilder()
package org.scribe.oauth;
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.Token;
/*
* @author jerry
*/
public final class MagentoThreeLeggedOAuth extends DefaultApi10a {
// NOTE as there is no central service for Magento, this does not suit Builder pattern. Must map to your store
@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-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 / 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 / gist:329f3b7e0a4348c1e99010de2e6bcaa7
Created September 4, 2018 14:40
Exemplo de tratamento de exception Mule
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch Exception Strategy" when="#[exception.causedBy(org.mule.api.transformer.TransformerException)]">
<set-payload doc:name="Set Payload" value="#[payload]">
<jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="Dead.Letter.Invalid.Data">
</jms:outbound-endpoint></set-payload></catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Database Connection Exception" when="#[exception.causedBy(java.sql.SQLException)]">
<set-payload doc:name="Set Payload" value="#[payload]">
<jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="Dead.Letter.Invalid.Data">
</jms:outbound-endpoint></set-payload></catch-exception-strategy>
<catch-exception-strategy doc:name="Catch ActiveMQ Connection Exception" when="#[exception.causedBy(java.lang.Exception)]">
@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.