Skip to content

Instantly share code, notes, and snippets.

View andreylitvinchuk's full-sized avatar

Andrey Litvinchuk andreylitvinchuk

View GitHub Profile
@andreylitvinchuk
andreylitvinchuk / gist:88ad98335e86b638592f8e4859097f36
Last active March 31, 2019 17:12
Yandex metrix. Universal way for working with goals
function yaCounterObject(){
var yaCounterKey = Object.keys(window).find( function(el, ind, ar){
return el.search('yaCounter') >= 0 ? true : false ;
})
console.log('yaCounterKey', yaCounterKey)
var yaCounterObject = window[yaCounterKey]
// console.log('yaCounterObject',yaCounterObject)
return yaCounterObject
}
@andreylitvinchuk
andreylitvinchuk / result_modifier.php
Created March 29, 2016 10:40
Добавить ключ для кэширования в шаблоне компонента
$this->__component->arResultCacheKeys = array_merge($this->__component->arResultCacheKeys, array('DETAIL_PAGE_URL'));
//TODO: начало зоны кэширования. зависимости: $somevar
/* кэшируемые переменные
$var
* */
$obCache = new CPHPCache();
$cache_time = 3600;
$cache_id = 'cacheName'.$somevar;//
$cache_path = '/cacheName/';
if( $obCache->InitCache($cache_time, $cache_id, $cache_path) ):// Если кэш валиден
//$easyCacheTimer1->timerLog("Кэш валиден");