Skip to content

Instantly share code, notes, and snippets.

function locationParams(specific, value) {
var result = {},
loc = location.search.length ? location.search.slice(1).split('&') : null;
if (loc) {
loc.forEach(function (item) {
item = item.split('=');
if (item.length > 1 && item[0] && item[1]) result[item[0]] = item[1];
});
result = !value && specific && specific in result ? result[specific] : result;
}
export default function locationParams(specific = null, value = null) {
let result = {},
loc = location.search.length ? location.search.slice(1).split('&') : null;
if (loc) {
loc.forEach(function (item) {
item = item.split('=');
if (item.length > 1 && item[0] && item[1]) result[item[0]] = item[1];
});
result = !value && specific && specific in result ? result[specific] : result;
}
@milkamil93
milkamil93 / gist:9ca5e24078ecb66c8a5109c00fbff31b
Created January 29, 2020 10:01 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
console.warn('УДАЛИ МЕНЯ!');
;(function () {
var mySwipe = {
inWork: false,
xDown: null,
yDown: null,
xStart: null,
yStart: null,
event: null,
currentDirection: null,
1. Получаем хэш-код коммита, к которому хотим вернуться.
2. Заходим в папку репозитория и пишем в консоль:
$ git reset --hard a3775a5485af0af20375cedf46112db5f813322a
$ git push --force
@milkamil93
milkamil93 / data.php
Last active July 24, 2024 10:04
Массив для бота в телеграмм с набором ссылок и ключевых слов
<?php
// ключи только в нижнем регистре
// если нет какой-то языковой версии, то просто удаляем из массива вместе с ключом
return [
[
'keys' => ['doclister', 'доклистер', 'doc lister', 'док листер', 'дитто', 'ditto', 'dito', 'дито'],
'doc_links' => [
'ru' => '<a href="https://github.com/evocms-community/docs/tree/master/ru/04_%D0%9A%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D1%8B/DocLister">DocLister</a>',
'en' => '<a href="https://github.com/evocms-community/docs/tree/master/en/04_Extras/DocLister">DocLister</a>',