Get weekday name with intl
new Intl.DateTimeFormat('ru-RU', { weekday: 'short' }).format(new Date()) //пн
19 апреля 2021, 23:32
new Intl.DateTimeFormat('ru-RU', { weekday: 'short' }).format(new Date()) //пн
const date = new Date(); const d1 = new Date( date.getFullYear(), date.getMonth(), date.getDay(), date.getHours(), 0, 0, 0, ); const d2 = new Date( date.getFullYear(), date.getMonth(), date.getDay(), date.getHours(), 59, 59, 999, ); console.log(d1); // 2021-03-05T09:00:00.000Z console.log(d2); // 2021-03-05T09:59:59.999Z
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs
ln -s /opt/homebrew/Cellar/pcre2/10.36/include/pcre2.h /opt/homebrew/Cellar/php/8.0.2/include/php/ext/pcre
sudo adduser \ --system \ --shell /bin/bash \ --gecos 'description' \ --group \ --disabled-password \ --home /home/us \ us
npm rebuild node-sass
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
sudo apt-get remove -y docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
brew tap homebrew-ffmpeg/ffmpeg brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac
"open_files_in_new_window": false
defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder
export NODE_OPTIONS=--max_old_space_size=4096
<?php
function slugify($string) {
$translit = "Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();";
$string = transliterator_transliterate($translit, $string);
$string = preg_replace('/[-\s]+/', '-', $string);
return trim($string, '-');
}
echo slugify("Я люблю PHP!");
SELECT d::date FROM generate_series( timestamp without time zone '2021-01-01', timestamp without time zone '2021-02-01', '1 day' ) AS gs(d);
knex(
knex('A').where('A.id',1).as('t1')
).leftJoin(
knex('B').where('B.id', 2).as('t2'),
't1.c',
't2.d'
)
SELECT setval('your_table_id_seq', COALESCE((SELECT MAX(id)+1 FROM your_table), 1), false)
or
SELECT
setval(pg_get_serial_sequence('tbl', 'id'), COALESCE(max(id) + 1, 1), FALSE)
FROM
tbl;
function endOfWeek(date) {
const lastday = date.getDate() - (date.getDay() - 1) + 6;
return new Date(date.setDate(lastday));
}
const dt = new Date();
console.log(endOfWeek(dt).toString());
certbot run -a manual -i nginx -d example.com
select enum_range(null::my_type)
service --status-all