This file contains hidden or 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 declare(strict_types=1); | |
use Swift_Events_SendEvent; | |
use Swift_Events_SendListener; | |
use Swift_Plugins_Sleeper; | |
/** | |
* Plugin for fix timeout errors on sending mails from message queue (rabbitMQ) with persistent connection to SMTP server | |
*/ | |
class Swift_Plugins_Timeout_Plugin implements Swift_Events_SendListener, Swift_Plugins_Sleeper |
This file contains hidden or 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
window.SimpleStorage = (function () { | |
const storageName = 'tmpName'; | |
return{ | |
get: function (id) { | |
var storage = localStorage.getItem(storageName); | |
if(storage)try { | |
storage = JSON.parse(storage); | |
return typeof storage[id] !== 'undefined' ? storage[id] : null; | |
} catch (e) { | |
return null; |
This file contains hidden or 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
<? | |
/** | |
* Get buffer of bitrix component template | |
* @param CBitrixComponent $component | |
* @param CBitrixComponent $arParams | |
* @return string $template | |
*/ | |
function getTemplate(&$component, &$arParams){ | |
ob_start(); | |
if($arParams['TEMPLATE'] == 'LIST') |
This file contains hidden or 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
/** | |
* Get data from many forms | |
* Work in IE11+ and work with file ajax upload | |
*/ | |
var | |
data = new FormData($('#form1')[0]), | |
form_2 = $('#form2').serializeArray(); | |
form_2.forEach(function(fields){ | |
data.append(fields.name, fields.value); |
This file contains hidden or 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
function naturalSort(stringArray) { | |
var xor = function(a, b) { | |
return a ? !b : b; | |
}; | |
var isDigit = function(chr) { | |
var charCode = function(ch) { | |
return ch.charCodeAt(0); | |
}; | |
var code = charCode(chr); | |
return (code >= charCode('0')) && (code <= charCode('9')); |
This file contains hidden or 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
function rand(min, max) { // get random integer by min and max range | |
return Math.floor(Math.random() * (max - min)) + min; | |
} |