Skip to content

Instantly share code, notes, and snippets.

View Bat-Chat's full-sized avatar

Vladyslav Shestopalov Bat-Chat

View GitHub Profile
@Bat-Chat
Bat-Chat / overriding old tag
Created July 11, 2016 15:07
overriding old tag (move tag to latest commit)
Use the -f option to git tag:
-f
--force
Replace an existing tag with the given name (instead of failing)
You probably want to use -f in conjunction with -a to force-create an annotated tag instead of a non-annotated one.
Example
@Bat-Chat
Bat-Chat / local.xml
Created July 12, 2016 11:31
Add this file for printing errors in magento (src/errors/local.xml)
<?xml version="1.0"?>
<!--
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
@Bat-Chat
Bat-Chat / gist:fe6275e2776c0aa9536f0b2815121b2e
Last active July 30, 2016 21:44
Chose shop in index.php
$mageRunCode = 'shopAlias';
@Bat-Chat
Bat-Chat / Add tag in git
Created July 30, 2016 22:26
Add tag and push it to stage
git fetch --tags
git tag
git tag -a v1.0.52 -m 'Commit description'
git push origin v1.0.52
then on stage repository:
git branch stage
git pull origin stage
then change composer.json (set new version for package)
@Bat-Chat
Bat-Chat / query by native sql
Created July 30, 2016 23:04
запись в базу нативным sql-ом
запись в базу нативным sql-ом
$writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
$table = $resource->getTableName('catalog/product');
$currentTime = date('Y-m-d H:i:s', time());
$query = "UPDATE {$table} SET column = column + 1 WHERE updated_at = {$currentTime}";
$writeConnection->query($query);
@Bat-Chat
Bat-Chat / zendDate
Last active May 22, 2018 22:16
# time in magento
$zendDate = Mage::app()->getLocale()->date();
$zendDate->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$zendDate->sub('30',Zend_Date::MINUTE_SHORT)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
echo ceil((7/0)*100); // Warning: Division by zero
echo "\n\n";
echo "no Warning:) \n", ceil(@(7/0)*100);
find . -type d | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
List All Indexes
curl 'localhost:9200/_cat/indices?v'
Find records in index
curl 'localhost:9200/idx_name_idx2/_search?pretty=true&q=*:*'
sudo service elasticsearch restart
SELECT * FROM label_eav_attribute where attribute_code = 'attr_code'
SELECT * FROM label_catalog_product_entity_varchar where attribute_id = 194 and entity_id = 589