Skip to content

Instantly share code, notes, and snippets.

@zainengineer
zainengineer / magento_enntry.php
Last active September 27, 2021 10:50
Magento entry script
<?php
umask(0);
require 'app/Mage.php';
Mage::setIsDeveloperMode(true);
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(0);
Mage::app();
@zainengineer
zainengineer / code_snippets.php
Last active June 20, 2016 03:10
eschrade Magento EE Indexes
<?php
// Decoded HTML for http://www.eschrade.com/page/indexing-in-magento-or-the-wonderful-world-of-materialized-views/
$logTable = Mage::getModel('log/log')->getResource()->getTable('url_table');
//Separator
$pkData = $this->_conn->getIndexList($logTable);
if (!isset($pkData['PRIMARY']['COLUMNS_LIST'][0])) {
Mage::throwException('Unable to find log table primary key');
@zainengineer
zainengineer / eschrad_magento_ee_indexes.xml
Last active June 20, 2016 03:52
eschrade Magento EE indexes XML
<catalog_product_price>
<model>enterprise_catalog/index_dummy_price</model>
<action_model>
<changelog>enterprise_catalog/index_action_product_price_refresh_changelog</changelog>
<all>enterprise_catalog/index_action_product_price_refresh</all>
</action_model>
<index_table>catalog_product_index_price</index_table>
<sort_order>40</sort_order>
</catalog_product_price>
@zainengineer
zainengineer / history.js
Last active February 16, 2017 11:27
youtube history remove bulk
#go to youtube history page and copy pate the javascript
#in history load videos roughly upto where you want to delete
#I use it so youtube does not suggest me nursery rhyms
removeHistory = function (){
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').click();
window.setTimeout(function () {
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').remove();
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').scrollIntoView();
console.log('done');
@zainengineer
zainengineer / rsync_ruby.MD
Created February 17, 2017 06:44
vagrant rsync-auto ruby issues
@zainengineer
zainengineer / container_ip.bash
Last active February 2, 2023 21:20
Get docker container ip
#!/usr/bin/env bash
#inside docker container
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
CONTAINER_IP=$(curl "$HOST_IP:8000" 2>/dev/null)
echo "container ip is $CONTAINER_IP"
@zainengineer
zainengineer / script.sh
Last active April 12, 2024 01:41
bash script path
#!/usr/bin/env bash
script_path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
root_path=$(dirname $(dirname $(dirname "$script_path")));
#for simple any level using ..
script_path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
dirname=$(realpath "$script_path/..")
<global>
<session_save><![CDATA[db]]></session_save>
<cache>
<backend>database</backend>
</cache>
</global>
<?php
//n98-magerun2.phar dev:console
#useful for old multi-stock implementation for magento
#but can be skipped
$stockId = 7;
$storeId = 3;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
//had NO EFFECT
$iStoreId = 9;
class_exists('\Kint',false) && (\Kint::$max_depth =3);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
$storeManager =$objectManager->create('\Magento\Store\Model\StoreManagerInterface');
//has NO EFFECT
$storeManager->setCurrentStore($iStoreId);