document.querySelector(".box").addEventListener("click", function(e) {
e.target.classList.toggle("red");
})
function upper(obj) {
return Object.keys(obj).map(key => key.toUpperCase())
}
<?php
return [
'support' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mailmail.ru',
'username' => 'support@mail.ru',
'password' => 'c',
'port' => '465',
'encryption' => 'ssl',
],
],
'noReply' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mail.mail.ru',
'username' => 'noreply@mail.ru',
'password' => '',
'port' => '465',
'encryption' => 'ssl',
],
],
];
$mailers = require __DIR__ . '/../components/mailer/config.php';
'components'=> [
...
'supportMailer' => $mailers['support'],
'noreplyMailer' => $mailers['noReply'],
...
]
Yii::$app=>supportMailer ...
Yii::$app=>noreplyMailer...
const count = str => [...str]
.reduce((acc, n, i, a) => (
a[i - 1] !== n && acc.push([ n, 0 ]),
acc[acc.length - 1][1]++,
acc
), [])
.flat()
.join('');
const count = str => str.replace(/(.)\1*/g, m => m[0] + m.length);
const elements = document.querySelectorAll('div[data-atr]')
elements.forEach(elem => elem.style = elem.dataset.atr);
Object.values(arr.reduce((acc, [ user, ...data ]) => {
(acc[user] = acc[user] ?? { user, data: [] }).data.push(data);
return acc;
}, {}))
const getMaxIndexes = (arr, count) => Object
.entries(arr.reduce((acc, n, i) => ((acc[n] = acc[n] ?? []).push(i), acc), {}))
.sort((a, b) => b[0] - a[0])
.flatMap(n => n[1])
.slice(0, count);