Skip to content

Instantly share code, notes, and snippets.

View kl177's full-sized avatar

kl177 kl177

View GitHub Profile
@kl177
kl177 / gist:590f9489e71ae01d4443
Created September 9, 2014 14:52
throw exceptions on SQL errors
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
git config core.filemode false
@kl177
kl177 / gist:8036742
Last active December 31, 2015 19:59
mysql snippets

MYSQL snippets

Замена текста:

replace([field_name],'[string_to_find]','[string_to_replace]')

Export:

mysqldump -u [uname] -p[pass] [dbname] > [backupfile.sql]
@kl177
kl177 / gist:7943162
Last active December 31, 2015 05:49
Linux

Linux

Показывает список запущенных процессов

ps -ef

Удаляет с файла строку которая содержит test

sed -i '/test/d' test.txt
@kl177
kl177 / gist:7907066
Last active December 31, 2015 00:19
Disable right click without javascript
<body oncontextmenu="return false;">
@kl177
kl177 / gist:7772663
Last active December 30, 2015 03:59
JS snippets

JS snippets

Заменить все вхождения "abc" в строке

str = str.replace(/abc/g, '');
@kl177
kl177 / gist:7543327
Last active May 3, 2019 05:44
jQuery snippets

jQuery snippets

Unbind all events

jQuery(".gallerylink").add("*").off();

or "click" event

jQuery(".gallerylink").unbind("click");
@kl177
kl177 / gist:7537427
Last active December 28, 2015 17:39
CSS snippets

CSS snippets

Перенос длинных слов

width: 100%;
word-wrap: break-word;

Добавление иконки со спрайта перед блоком

@kl177
kl177 / gist:7252808
Created October 31, 2013 16:35
не проверено
UPDATE catalog_eav_attribute SET used_in_product_listing=1
WHERE attribute_id IN (
SELECT attribute_id FROM eav_attribute
INNER JOIN eav_entity_type USING(entity_type_id)
WHERE entity_type_code='catalog_product' AND attribute_code IN (
'name', 'description', 'short_description',
'price', 'special_price', 'special_from_date', 'special_to_date',
'image', 'small_image', 'thumbnail',
'status', 'tax_class_id', 'url_key', 'required_options',
'price_type', 'weight_type', 'price_view', 'shipment_type',
@kl177
kl177 / Collection.php
Created October 14, 2013 12:46
Метод получения атрибутов на странице сравнения с сортировкой как на странице товара. файл: app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Product\Compare\Item\Collection.php
public function getComparableAttributes()
{
if (is_null($this->_comparableAttributes)) {
$this->_comparableAttributes = array();
$setIds = $this->_getAttributeSetIds();
if ($setIds) {
$select = $this->getConnection()->select()
->from(array('main_table' => $this->getTable('eav/attribute')))
->join(
array('additional_table' => $this->getTable('catalog/eav_attribute')),