Skip to content

Instantly share code, notes, and snippets.

@victordit
victordit / Listing all Magento Events in a txt
Created March 31, 2016 10:31 — forked from IzyPizy/Listing all Magento Events in a txt
Not all the version look the same, so do not use lists got from the web. A simple cli command that lists all the events included local & community extension
grep -rin -B2 -A2 "Mage::dispatchEvent" pathToMagentoRoot/app/* > events.txt
<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/
@victordit
victordit / gist:3e41c634721874574134ce050f37d40f
Created November 17, 2017 18:25 — forked from Steven-Rose/gist:3943830
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
@victordit
victordit / git.migrate
Created July 31, 2019 14:21 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@victordit
victordit / curl.md
Created December 10, 2019 15:57 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@victordit
victordit / magento2-clear.sql
Created December 20, 2019 13:42 — forked from sergiojovanig/magento2-clear.sql
Magento 2 Clear Database
##########################################################
# PRODUCTS
##########################################################
DELETE FROM `catalog_product_bundle_option`;
DELETE FROM `catalog_product_bundle_option_value`;
DELETE FROM `catalog_product_bundle_selection`;
DELETE FROM `catalog_product_entity_datetime`;
DELETE FROM `catalog_product_entity_decimal`;
DELETE FROM `catalog_product_entity_gallery`;
DELETE FROM `catalog_product_entity_int`;
@victordit
victordit / export_categories_m1.php
Created July 9, 2020 01:19 — forked from bluec/export_categories.php
Export Magento category tree with full names, paths and URLs
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
@victordit
victordit / shell_delete_unused_images
Created August 6, 2020 12:58 — forked from aleron75/shell_delete_unused_images
Delete no more used Product Images on Magento 1
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@victordit
victordit / composer_versions_cheatsheet.md
Created September 18, 2020 10:11 — forked from calebporzio/composer_versions_cheatsheet.md
Composer version symbol cheatsheet
...
"require": {
    "vendor/package": "1.3.2", // exactly 1.3.2 (exact)

    // >, <, >=, <= | specify upper / lower bounds
    "vendor/package": ">=1.3.2", // anything above or equal to 1.3.2
    "vendor/package": "<1.3.2", // anything below 1.3.2

 // * | wildcard
@victordit
victordit / remove-table-prefixes.sql
Created October 19, 2020 10:22 — forked from molotovbliss/remove-table-prefixes.sql
Remove table prefixes MySQL
# Set @database, @old_prefix and @new_prefix (if you want a different prefix instead of removing)
# Execute the Generated SQL Query this generates to rename all tables found with prefix.
SET SESSION group_concat_max_len = 999999999;
SET @database = "databasename";
SET @old_prefix = "mgn_";
SET @new_prefix = "";
SELECT GROUP_CONCAT("RENAME TABLE ", TABLE_NAME, " TO ", replace(TABLE_NAME, @old_prefix, @new_prefix),'; ' separator '')
FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database AND TABLE_NAME LIKE CONCAT(@old_prefix, '%');