Skip to content

Instantly share code, notes, and snippets.

View dgitman's full-sized avatar

David Gitman dgitman

View GitHub Profile
@ajankovic
ajankovic / magento_env.php
Created November 14, 2012 17:40
Init Magento environment for custom scripts
// I want to see errors
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Modify the PHP Environment
ini_set('memory_limit', '2048M');
// Load Up Magento Core
define('MAGENTO', realpath('..'));
require_once(MAGENTO . '/app/Mage.php');
@ryaan-anthony
ryaan-anthony / gist:8289750
Created January 6, 2014 21:00
create the following procedure, then to call it: type "call sort_categories;" in mysql.
delimiter ;;
drop procedure if exists sort_categories;;
create procedure sort_categories()
begin
DECLARE cur_id BIGINT UNSIGNED;
DECLARE cur_eof INT DEFAULT FALSE;
DECLARE cur CURSOR FOR
SELECT entity_id
FROM catalog_category_entity_varchar
WHERE attribute_id = (
@Gabelbombe
Gabelbombe / repeat-vs-firsttime.sql
Last active February 1, 2016 17:40
Magento: Customer Segmentation Reports (Repeat vs. First Time Buyers) in Donut Chart format (http://goo.gl/4MoAh0)
#################################################################
#################################################################
# ○ The number and percentage of customers who placed an order #
# ○ VS. number and percentage of repeat customer orders #
# #
# +------------------+-------+------------+ #
# | Type | Count | Percentage | #
# +------------------+-------+------------+ #
# | Total Customers | 35 | 100.0% | #
# | Single Customers | 1 | 2.9% | #
<?php
require_once 'app/Mage.php';
Mage::app();
Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID);
$products = Mage::getModel('catalog/product')->getCollection();
//->addAttributeToFilter('entity_id', array('gt' => 14000));
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
@mpchadwick
mpchadwick / Mpchadwick_Missing_Acl_Checker.php
Created July 11, 2015 03:42
Mpchadwick_Missing_Acl_Checker.php
<?php
require_once 'abstract.php';
/**
* Generate a CSV of modules with admin routes that haven't implemented _isAllowed()
*/
class Mpchadwick_Missing_Acl_Checker extends Mage_Shell_Abstract
{
const MODULES_PATH = 'modules';
@georanma
georanma / Dockerfile
Created March 20, 2019 20:34
Docker Magento 1 w/ Xdebug
FROM php:7.2-fpm
RUN apt-get -qq update && apt-get -qq install libxml++2.6-dev > /dev/null
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
zlib1g-dev \
libicu-dev \
g++ \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
@erfanimani
erfanimani / .gitignore
Last active June 1, 2019 10:22
A refactored and modern .gitignore for Magento. Compatible for Git versions 2.7.0+. See this revision to use it for versions lower than 2.7.0: https://gist.github.com/erfanimani/8856964/886f5d79d229c21b9c712155c362e5fc1c61a12a
### MAGENTO DIRECTORIES
# Ignore everything in media, except for the htaccess files
# Also include the Lazy Catalog Images (LCI) .htaccess if that's installed
# (https://github.com/AOEpeople/Aoe_LazyCatalogImages)
/media/*
!/media/.htaccess
!/media/customer/.htaccess
!/media/downloadable/.htaccess
!/media/catalog/product/LCI/.htaccess
@Vinai
Vinai / magento-composer-issues.md
Last active April 15, 2020 03:09
My beef with composer and Magento
@mickm
mickm / update-pingdom-iptables.sh
Created November 21, 2012 20:21
Whitelist Pingdom probe-servers in iptables.
#!/bin/bash
#
# Whitelist Pingdom probe-servers in iptables.
#
# Create a chain called "PINGDOM" and jump to it somewhere before
# the final REJECT/DROP, e.g.
#
# # New chain for Pingdom rules
# :PINGDOM - [0:0]
#
@selwin
selwin / innobackupex-runner.sh
Created August 8, 2011 04:46 — forked from dalecaru/innobackupex-restore.sh
Script to run innobackupex script (for all databases on server), check for success, and apply logs to backups.
#!/bin/sh
#
# Script to run innobackupex script (for all databases on server), check for success, and apply logs to backups.
#
# (C)2010 Owen Carter @ Mirabeau BV
# This script is provided as-is; no liability can be accepted for use.
# You are free to modify and reproduce so long as this attribution is preserved.
#
INNOBACKUPEX=innobackupex-1.5.1