(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой

Ok!
Ok!
25
SELECT CONVERT(CONVERT(message USING BINARY) USING cp1251) AS cp1251, 
       CONVERT(CONVERT(message USING BINARY) USING utf8) AS utf8 
FROM b_event_message bem 
WHERE CONVERT(message USING BINARY) RLIKE CONCAT('[', UNHEX('80'), '-', UNHEX('FF'), ']')
sql, script, detect wrong encoding506Обнаружить не так кодированную ячейку в таблице mysql
24
$rs_Section = CIBlockSection::GetList(
	array('DEPTH_LEVEL' => 'desc'),
	$ar_Filter,
	false,
	array('ID', 'NAME', 'IBLOCK_SECTION_ID', 'DEPTH_LEVEL', 'SORT')
);
$ar_SectionList = array();
$ar_DepthLavel = array();
while($ar_Section = $rs_Section->GetNext(true, false))
{
	$ar_SectionList[$ar_Section['ID']] = $ar_Section;
	$ar_DepthLavel[] = $ar_Section['DEPTH_LEVEL'];
}

$ar_DepthLavelResult = array_unique($ar_DepthLavel);
rsort($ar_DepthLavelResult);

$i_MaxDepthLevel = $ar_DepthLavelResult[0];

for( $i = $i_MaxDepthLevel; $i > 1; $i-- )
{
	foreach ( $ar_SectionList as $i_SectionID => $ar_Value )
	{
		if( $ar_Value['DEPTH_LEVEL'] == $i )
		{
			$ar_SectionList[$ar_Value['IBLOCK_SECTION_ID']]['SUB_SECTION'][] = $ar_Value;
			unset( $ar_SectionList[$i_SectionID] );
		}
	}
}

function __sectionSort($a, $b)
{
	if ($a['SORT'] == $b['SORT']) {
		return 0;
	}
	return ($a['SORT'] < $b['SORT']) ? -1 : 1;
}

usort($ar_SectionList, "__sectionSort");
битрикс, массив, перебор780Перебор массива Битрикс в виде дерева
23
$mySignatureValue = md5("$nOutSum:$nInvId:$mrh_pass1:shpdate=$shpdate:shpphone=$shpphone:shppin=$shppin:shptime=$shptime");
signature value, robokassa450Строка signature value для платежей через Робокассу
22
// Create an iframe:
const iframe = document.createElement('iframe');

// Put it in the document (but hidden):
iframe.style.display = 'none';
document.body.appendChild(iframe);

// Wait for the iframe to be ready:
iframe.onload = () => {
  // Ignore further load events:
  iframe.onload = null;

  // Write a dummy tag:
  iframe.contentDocument.write('<streaming-element>');

  // Get a reference to that element:
  const streamingElement = iframe.contentDocument.querySelector('streaming-element');

  // Pull it out of the iframe & into the parent document:
  document.body.appendChild(streamingElement);

  // Write some more content - this should be done async:
  iframe.contentDocument.write('<p>Hello!</p>');

  // Keep writing content like above, and then when we're done:
  iframe.contentDocument.write('</streaming-element>');
  iframe.contentDocument.close();
};

// Initialise the iframe
iframe.src = '';
iframe vs link1755Возможный способ ускорения загрузки через Javascript
21
<img src="http://bit.ly/2heoc2H" alt="Simon's cat" width="200" height="200">

img {
  object-fit: cover; // magic goes here
}
картинка, по ширине, по высоте, подогнать картинку, вместо background-size, object-fit190Решение с изображением, чтобы отображалось без сжатия и не бэкграунд
20
:root {
  font-size: calc(1vw + 1vh + .5vmin);
}

Now you can utilize the root em unit based on the value calculated by :root:


body {
  font: 1rem/1.6 sans-serif;
}
css, шрифт, адаптивно20Установка размера шрифта в CSS адаптивно изменяющегося к любой ширине экрана
19
К картинкам 
<img src="/img/eyes-l.jpg" srcset="/img/eyes-m.jpg 1x, /img/eyes.jpg 2x" alt="Глаза" height="375" width="500" data-p="/img/eyes.jpg">
<a href="#" rel="prefetch">Ссылка</a>
srcset, prefetch100srcset для изображений, предпросмотр для ссылок
18
Use the "update-ping" mechanism to permanently remove content from the Google AMP Cache after the content has been removed from its origin. For example, to purge content formerly served at https://cdn.ampproject.org/i/s/example.com/favicon.ico, send an update ping request to:
https://cdn.ampproject.org/update-ping/i/s/example.com/favicon.ico.
Cached content that no longer exists will eventually get removed from the cache; it's just faster to use "update-ping".
Google's Remove AMP content "documentation"
amp, удалить, гугл сео1234Убрать AMP описание удаленной страницы из Гугла
17
if($arParams["PREVIEW_TRUNCATE_LEN"] > 0 && strlen($arItem["PREVIEW_TEXT"])>5)
            $arItem["PREVIEW_TEXT"] = $obParser->html_cut($arItem["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
truncate, bitrix, prewiew text400Функция Битрикс для обрезки превью текста, если обрезка автоматически не работает
16
function getCoordinates($address){
    $address = urlencode($address);
    $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address;
    $response = file_get_contents($url);
    $json = json_decode($response,true);

    $lat = $json['results'][0]['geometry']['location']['lat'];
    $lng = $json['results'][0]['geometry']['location']['lng'];

    return array($lat, $lng);
}
координаты, гугл, php1050Функция получения координат через Гугл на php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27