This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// method beginner | |
var el = jQuery(this); | |
el.css('pointer-events','none'); | |
// ajax code | |
// method end | |
el.css('pointer-events','auto'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
AddEventHandler("catalog", "OnPriceUpdate", array("MyClassUpdatePrice", "OnBeforePriceUpdateHandler")); | |
AddEventHandler("catalog", "OnPriceAdd", array("MyClassUpdatePrice", "OnBeforePriceUpdateHandler")); | |
AddEventHandler("iblock", "OnBeforeIBlockElementDelete", Array("MyClassUpdatePrice", "OnBeforeIBlockElementDeleteHandler")); | |
class MyClassUpdatePrice | |
{ | |
function OnBeforePriceUpdateHandler($PRICE_ID, $arFields) { | |
if(!$arFields['PRICE']) $arFields['PRICE'] = 0; | |
if(!$arFields['PRODUCT_ID']) $arFields['PRODUCT_ID'] = $PRICE_ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
http://wp-kama.ru/question/php-usort-sortirovka-massiva-po-dvum-polyam | |
* Сортировка массива по двум параметрам с помощью usort() | |
*/ | |
function _usort_object_by_time_ms($a, $b){ | |
// поля по которым сортировать | |
$array = array( 'laps'=>'desc', 'time_ms'=>'asc' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adding the cluster icon to the dom. | |
* @ignore | |
*/ | |
ClusterIcon.prototype.onAdd = function() { | |
this.div_ = document.createElement('DIV'); | |
if (this.visible_) { | |
var pos = this.getPosFromLatLng_(this.center_); | |
this.div_.style.cssText = this.createCss(pos); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable scroll zooming and bind back the click event | |
var onMapMouseleaveHandler = function (event) { | |
var that = $(this); | |
that.on('click', onMapClickHandler); | |
that.off('mouseleave', onMapMouseleaveHandler); | |
//that.find('iframe').css("pointer-events", "none"); | |
that.find('#map-wrapper').css("pointer-events", "none"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function convertPHPSizeToBytes($sSize) | |
{ | |
if ( is_numeric( $sSize) ) { | |
return $sSize; | |
} | |
$sSuffix = substr($sSize, -1); | |
$iValue = substr($sSize, 0, -1); | |
switch(strtoupper($sSuffix)){ | |
case 'P': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect from index.php to / | |
RewriteCond %{THE_REQUEST} index.php [NC] | |
RewriteCond %{REQUEST_URI} !/bitrix/admin/.* [NC] | |
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Правило обрабатывает внутренние страницы | |
# http://site.ru/catalog////item/// | |
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ | |
#Проверяем, повторяется ли слеш (//) более двух раз. | |
RewriteRule . %1/%2 [R=301,L] | |
#Исключаем все лишние слеши. | |
#удаляем слеши для главной http://site.ru///// | |
RewriteCond %{THE_REQUEST} ([^\s]*)\/{2,}(\?[^\s]*)? | |
RewriteRule (.*) / [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Преобразование количества "цифрой" в количество "словом" | |
* Чтобы было удобнее формировать массивы со склонениями, запомните ряд чисел 1-2-5, | |
* а потом мысленно подставляйте их в массив: (один "рубль", два "рубля", пять "рублей") | |
* $num = 3; | |
* $words = array('новость', 'новости', 'новостей'); | |
* echo $num . ' ' . num2word($num, $words); // сколько новостей | |
* | |
* @param $n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
$cp = $this->__component; // объект компонента | |
if (is_object($cp)) { | |
$cp->arResult['NAV_RESULT'] = $arResult['NAV_RESULT']; | |
$cp->SetResultCacheKeys(Array('NAV_RESULT')); | |
} | |
*/ | |