Skip to content

Instantly share code, notes, and snippets.

View thiagolima-bm's full-sized avatar

Thiago thiagolima-bm

View GitHub Profile
@thiagolima-bm
thiagolima-bm / gist:9157102
Created February 22, 2014 15:58
javascript base-64 encoded image
function getBase64Image(img) {
// Create an empty canvas element
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
// Copy the image contents to the canvas
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
@thiagolima-bm
thiagolima-bm / orderCreate.php
Last active September 8, 2015 18:36 — forked from trabulium/orderCreate.php
Magento: Create Order from a Previous Order Programmatically
<?php
define('MAGENTO_ROOT', "/var/www/web");
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
@thiagolima-bm
thiagolima-bm / gist:b6072d119fef6b31b653
Last active September 8, 2015 18:46 — forked from brankoajzele/gist:2781404
Programatically create Magento order with tablerate shipping
<?php
require_once 'app/Mage.php';
Mage::app();
$quote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore('default')->getId());
$product = Mage::getModel('catalog/product')->load(6); /* 6 => Some product ID */
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@thiagolima-bm
thiagolima-bm / Install Composer using MAMP's PHP.md
Created March 24, 2016 16:42 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@thiagolima-bm
thiagolima-bm / order-uncancel.php
Created September 13, 2017 08:44 — forked from derak-kilgo/order-uncancel.php
One-off tool to uncancel an order in magento 1.x
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the commend line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/
require_once('app/Mage.php');
umask(0);
if (!Mage::isInstalled()) {
@thiagolima-bm
thiagolima-bm / CHANGELOG.md
Created January 25, 2018 13:35
Guia de desenvolvimento Magento 2

Testando

@thiagolima-bm
thiagolima-bm / set-multiple-magento-2-websites-stores-nginx
Created March 20, 2019 14:47
Configure Multiple Magento2 Websites or Stores with Nginx
#etc/nginx/sites-available
map $http_host $MAGE_RUN_CODE {
mystore.com mystore_en;
mystore.de mystore_de;
mystore.es mystore_es;
}
server {
listen 80;
server_name mystore.com mystore.de mystore.es;
@thiagolima-bm
thiagolima-bm / data.json
Last active February 19, 2020 23:18
War2
{
"continents": [
{
"id": 1,
"name": "América do Sul",
"countries": [1, 2, 3, 4]
},
{
"id": 2,
"name": "América do Norte",