Skip to content

Instantly share code, notes, and snippets.

View konratnox's full-sized avatar

Alexey konratnox

  • Russia, SPb
View GitHub Profile
i - интерактифный режим, изменяешь текст
esс - выйти из него
:q - выход
:w - записать в файл
:q! - выход и не вносить изменений( на случай когда натворил что-то) ))
интеактиыный режим это когда что-то ручками надо менять, в него надо войти, после того как файл открываешь
а это все - командный режим - ну вводишь команды крч. Он открывается когда ты файл открываешь
BOPTI=`du -L -s ${SITEDIR} | awk '{print $1}'`
find -L ${SITEDIR} -type f -iname '*.jpg' \
-exec jpegoptim -q --strip-all {} \; \
-exec chown ${SITEUSER}:www-data {} \; \
-exec chmod 664 {} \;
find -L ${SITEDIR} -type f -iname '*.png' \
-exec optipng -quiet -clobber -fix -strip all {} \; \
-exec chown ${SITEUSER}:www-data {} \; \
define("BASE_URL", "http://ws3.morpher.ru/russian/declension");
function api_request($resource, $method) {
$full_url = BASE_URL . "$resource";
$options = array(
CURLOPT_URL => $full_url,
CURLOPT_HTTPHEADER => array('Content-Type: application/json',
'Accept: application/json'),
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
$data = \Bitrix\Main\Diag\Helper::getBackTrace($limit = 0, $options = null);
\Bitrix\Main\Diag\Debug::dumpToFile(array('ID' => $id, 'fields'=>$data ),"", "dumpClean.txt");
Bitrix\Main\Diag\Debug::startTimeLabel("label1");
Bitrix\Main\Diag\Debug::endTimeLabel("label1");
Bitrix\Main\Diag\Debug::dump(Bitrix\Main\Diag\Debug::getTimeLabels());
$jsonItems = [
'@context' => 'http://schema.org',
'@type' => 'BreadcrumbList',
'itemListElement' => []
];
$jsonItems['itemListElement'][] = [
'@type' => 'ListItem',
'position' => $index + 1,
'item' => [
'@id' => $link,
<?
define("BASE_URL", "http://ws3.morpher.ru/russian/declension");
function morphWord($resource, $method) {
$full_url = BASE_URL . "$resource";
$options = array(
CURLOPT_URL => $full_url,
CURLOPT_HTTPHEADER => array('Content-Type: application/json',
'Accept: application/json'),
CURLOPT_CUSTOMREQUEST => $method,
function BinarySearch(t,A) // t - искомый элемент,
{ // A - упорядоченный массив, в котором ищем.
var i = 0, j = A.length, k;
while (i < j)
{ k = Math.floor((i+j)/2);
if (t <= A[k]) j = k;
else i = k+1;
}
<?
if ($_GET["PAGEN_" . $arResult['ARR_NAV']["NavNum"]] > 0 && $arResult['ARR_NAV']["NavPageNomer"] != $_GET["PAGEN_" . $arResult['ARR_NAV']["NavNum"]]) {
define('ERROR_404', 'Y');
return;
}
<?
if ($arResult['ARR_NAV']["NavPageNomer"] == 2) {
// $APPLICATION->SetPageProperty("robots", "noindex, follow");
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}'>");
}
elseif ($arResult['ARR_NAV']["NavPageNomer"] > 2) {
// $APPLICATION->SetPageProperty("robots", "noindex, follow");
$prevPage = $arResult['ARR_NAV']["NavPageNomer"] - 1;
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}?PAGEN_{$arResult['ARR_NAV']["NavNum"]}={$prevPage}'>");
<?
foreach ($_POST['NEW_PHOTO_SIZE'] as $index=>$value) {
if(is_array($value))
{
$filePath = $value['tmp_name'];
}
else
{
$filePath = $value;
}