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

Ok!
Ok!
226
var player = {score: 1, name: 'Jeff'};
var newPlayer = Object.assign({}, player, {score: 2}); 
// or var newPlayer = {...player, score: 2};

create new object, js100300Создать новый объект из старого в Javascript
225
<a href="https://api.whatsapp.com/send?phone=79269946796" target="_blank" class="header__social-link" data-menu-exit>
wa, whatsapp200Whatsapp
224
&#8381;
рубль, html100500символ рубля в html
223
public function convertImage(&$content)
    {
        if (defined('ADMIN_SECTION') || defined('WIZARD_SITE_ID')) {
            return;
        }

        preg_match_all('/"(/upload/[^"]*.(jpg|jpeg|png))"/i', $content, $matches1);
        self::convertImageToWebp($content, $matches1);
        preg_match_all("/'(/upload/[^']*.(jpg|jpeg|png))'/i", $content, $matches2);
        self::convertImageToWebp($content, $matches2);
    }

    private static function convertImageToWebp(&$content, $matches) {
        if (!empty($matches[1])) {
            foreach ($matches[1] as $i => $imageUrl) {
                $root = $_SERVER['DOCUMENT_ROOT'];
                $type = $matches[2][$i];
                $newName = str_replace($type, 'webp', $imageUrl);
                if (file_exists($root . $newName)) {
                    $content = str_replace($imageUrl, $newName, $content);
                    continue;
                }
                if (!file_exists($root . $imageUrl)) {
                    continue;
                }
                $type = strtolower($type);
                switch ($type) {
                    case 'jpeg':
                    case 'jpg':
                        $img = imagecreatefromjpeg($root . $imageUrl);
                        break;
                    case 'png':
                        $img = imagecreatefrompng($root . $imageUrl);
                        imagepalettetotruecolor($img);
                        imagealphablending($img, true);
                        imagesavealpha($img, true);
                        break;
                }
                if (isset($img)) {
                    $result = imagewebp($img, $root . $newName, 75);
					
					if (!$result) {
						continue;
					}

                    $content = str_replace($imageUrl, $newName, $content);
                    imagedestroy($img);
                    unset($img);
                }
            }
        }
    }
bitrix, webp, convert20030convert image to webp bitrix
222
echo <<<EOH
 ----------   ----------- -- ----------
 результат      значение      оп тест
 ----------   ----------- -- ----------
EOH;
eoh, php print formated12090Форматированная строка в PHP
221
User-agent: *
Disallow: /

User-agent: Googlebot
User-agent: AdsBot-Google
Disallow: /
disallow all, robots130Запретить индексайцию всем роботам и рекламным ботам
220
// Перенаправляем пользователя на страницу оплаты
Header("Location: http://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin=$mrh_login&OutSum=$out_summ&InvId=$inv_id".
              "&InvDesc=$inv_desc&SignatureValue=$crc".
              "&Culture=$culture&Encoding=$encoding&Email=$email");
header, location, php120Перенаправляем пользователя на страницу оплаты Header
219
/**
 * year start count from
 * input @string ('1987')
 * return years since @string
 */
function year_skils($Y) {
  $years = date("Y") - date("Y", strtotime($Y));
  $year_text = ($years%2==0|$years%3==0|$years%4==0)?"года":(($years%10==1&&$years!=11)?"год":"лет");
  return $years . "&nbsp;" . $year_text;
}
php, years, year, лет по-русски23090php сколько лет с тех пор по-русски
218
function loadScript(url, callback) { 
  const element = document.createElement("script"); 
  element.type = "text/javascript"; 
  element.src = url; 
  element.onload = callback; 
  document.body.appendChild(element); 
}

loadScript("js/common.js", () => {
loadScript("<https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js>",
() => {
console.log("timer.js ")
})
})
loadscript, js1200Скрипт чтоб загрузить другой скрипт
217
$len = 10;   // total number of numbers
$min = 100;  // minimum
$max = 999;  // maximum
$range = []; // initialize array
foreach (range(0, $len - 1) as $i) {
    while(in_array($num = mt_rand($min, $max), $range));
    $range[] = $num;
}
print_r($range);
exclusive random, эксклюзивный2040Эксклюзивный выбор рандомных чисел
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