Skip to content

Instantly share code, notes, and snippets.

@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
<?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);
curl http://127.0.0.1 -H 'Host: example.com' -H 'X-Forwarded-Proto: https'
curl https://127.0.0.1/ -H 'Host: example.com' -H 'X-Forwarded-Proto: https' --insecure
curl http://httpbin.org/headers -H 'Host: httpbin.org' -H 'X-Forwarded-Proto: https'
@zainengineer
zainengineer / composer
Created March 20, 2019 00:57
composer quickes
for private packages/magento modues consider using
"repositories": [
{"type":"artifact","url":"packages/"},
where packages/ has multiple zip files like vendor1_ext1.zip, vendor2_ext2.zip
and you just need to do composer require vendor1/ext1
composer will find in packages zipped files and get the required extensions
<global>
<session_save><![CDATA[db]]></session_save>
<cache>
<backend>database</backend>
</cache>
</global>
<?php
/**
* InternalLog
*
*/
class InternalLog
{
const TIMER_ACTION_START = 1;