snipt

Ctrl+h for KB shortcuts

JavaScript

Пендель для Google.Maps. Перерисовка карты, если карта выводится из скрытого слоя.

google.maps.event.trigger(GLOBAL_arMapObjects.googleRoadMap,'resize');
https://snippets.siftie.com/embed/3122fc3480f8be1d94a918558fabc3ad/
/raw/3122fc3480f8be1d94a918558fabc3ad/
3122fc3480f8be1d94a918558fabc3ad
js
JavaScript
1
2017-01-01T08:47:46
True
False
True
Sep 04, 2012 at 11:56 PM
/api/public/snipt/46701/
googlemaps
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">google</span><span class="p">.</span><span class="nx">maps</span><span class="p">.</span><span class="nx">event</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">GLOBAL_arMapObjects</span><span class="p">.</span><span class="nx">googleRoadMap</span><span class="p">,</span><span class="s1">&#39;resize&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
google.maps, js

JavaScript

event.preventDefault in IE

e.preventDefault ? e.preventDefault() : e.returnValue = false;
https://snippets.siftie.com/embed/f7cfd3488f0edb0a14dead42087bb6b6/
/raw/f7cfd3488f0edb0a14dead42087bb6b6/
f7cfd3488f0edb0a14dead42087bb6b6
js
JavaScript
1
2016-12-30T19:47:08
True
False
True
Jun 29, 2012 at 01:31 AM
/api/public/snipt/43169/
eventpreventdefault-in-ie
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span> <span class="o">?</span> <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">()</span> <span class="o">:</span> <span class="nx">e</span><span class="p">.</span><span class="nx">returnValue</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span> </span></pre></div> </td></tr></table>
IE, preventDefault

PHP

Транслитерация в Битрикс Cutil::translit($str, $lang, $params = array())

1
2
3
4
5
6
7
8
Cutil::translit($str, $lang, $params = array()) 
Параметры в массиве $params:
Параметр    Значение по умолчанию	Описание
"max_len"	100	Максимальная длина результата транслитерации
"change_case"	L	Приведение результата к регистру, L - к нижнему, U - верхнему
"replace_space"	_	Замена для символа пробела
"replace_other"	_	Замена для прочих символов
"delete_repeat_replace"	true	Удалять лишние символы замены
https://snippets.siftie.com/embed/602431fff0b39cce3a7799c96d8a07f5/
/raw/602431fff0b39cce3a7799c96d8a07f5/
602431fff0b39cce3a7799c96d8a07f5
php
PHP
8
2016-12-30T19:47:06
True
False
True
Jun 14, 2012 at 12:04 PM
/api/public/snipt/42316/
cutiltranslitstr-lang-params-array
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">Cutil::translit($str, $lang, $params = array()) </span> </span><span id="L-2"><a name="L-2"></a><span class="x">Параметры в массиве $params:</span> </span><span id="L-3"><a name="L-3"></a><span class="x">Параметр Значение по умолчанию Описание</span> </span><span id="L-4"><a name="L-4"></a><span class="x">&quot;max_len&quot; 100 Максимальная длина результата транслитерации</span> </span><span id="L-5"><a name="L-5"></a><span class="x">&quot;change_case&quot; L Приведение результата к регистру, L - к нижнему, U - верхнему</span> </span><span id="L-6"><a name="L-6"></a><span class="x">&quot;replace_space&quot; _ Замена для символа пробела</span> </span><span id="L-7"><a name="L-7"></a><span class="x">&quot;replace_other&quot; _ Замена для прочих символов</span> </span><span id="L-8"><a name="L-8"></a><span class="x">&quot;delete_repeat_replace&quot; true Удалять лишние символы замены</span> </span></pre></div> </td></tr></table>
bitrix, translit

PHP

Вставка хлебных крошек

<?$APPLICATION->IncludeComponent("bitrix:breadcrumb", ".default", Array("START_FROM" => "0","PATH" => "","SITE_ID" => "-"),false);?> 
https://snippets.siftie.com/embed/f6a20d69c85871632fc9f36f6ce9878c/
/raw/f6a20d69c85871632fc9f36f6ce9878c/
f6a20d69c85871632fc9f36f6ce9878c
php
PHP
1
2016-12-12T22:57:30
True
False
True
Jun 05, 2012 at 03:50 AM
/api/public/snipt/40748/
-209
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?</span><span class="nv">$APPLICATION</span><span class="o">-&gt;</span><span class="na">IncludeComponent</span><span class="p">(</span><span class="s2">&quot;bitrix:breadcrumb&quot;</span><span class="p">,</span> <span class="s2">&quot;.default&quot;</span><span class="p">,</span> <span class="k">Array</span><span class="p">(</span><span class="s2">&quot;START_FROM&quot;</span> <span class="o">=&gt;</span> <span class="s2">&quot;0&quot;</span><span class="p">,</span><span class="s2">&quot;PATH&quot;</span> <span class="o">=&gt;</span> <span class="s2">&quot;&quot;</span><span class="p">,</span><span class="s2">&quot;SITE_ID&quot;</span> <span class="o">=&gt;</span> <span class="s2">&quot;-&quot;</span><span class="p">),</span><span class="k">false</span><span class="p">);</span><span class="cp">?&gt;</span><span class="x"> </span> </span></pre></div> </td></tr></table>
bitrix

PHP

Сумма прописью, если установлен модуль sale

1
2
3
<?
Number2Word_Rus($source, $IS_MONEY = "Y");
?>
https://snippets.siftie.com/embed/cb16f59c443237b797694277dde04963/
/raw/cb16f59c443237b797694277dde04963/
cb16f59c443237b797694277dde04963
php
PHP
3
2019-04-10T17:27:18
True
False
True
Jun 05, 2012 at 03:50 AM
/api/public/snipt/40703/
sale
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">Number2Word_Rus</span><span class="p">(</span><span class="nv">$source</span><span class="p">,</span> <span class="nv">$IS_MONEY</span> <span class="o">=</span> <span class="s2">&quot;Y&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
bitrix