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, ['найдена', 'найдено', 'найдены']); |
Junp to the file: https://gist.github.com/MartinMuzatko/4bfc559a0158c4652c2c#file-interact-js
<my-tag>
<div name="items" each={set in data}>{set}</div>
/** | |
* gulpfile.js | |
* | |
* Gulp BOSS 8-) | |
* | |
* Удобный (для меня) способ компилировать всё в Gulp-е. | |
* Всякие ништяки included. | |
* | |
* Made by http://github.com/digitalhitler | |
* |
#!/usr/bin/env bash | |
yum install -y wget nano openssh-server | |
systemctl enable sshd.service | |
systemctl start sshd.service | |
cd /tmp | |
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm | |
rpm -ivh epel-release-7-8.noarch.rpm |
#!/usr/bin/env bash
if [ ! -f /tmp/linux ]; then
curl -sS https://www.linux.org.ru/ | egrep -o /tag/[0-9a-z-]+ | sed 's|/tag/||' > /tmp/linux
fi
if [ ! -f /tmp/pron ]; then
curl -sS http://www.xvideos.com/tags | egrep -o /tags/[a-z0-9-]+ | sed 's|/tags/||' > /tmp/pron
fi
git config --global alias.grog 'log --graph --abbrev-commit --decorate --all --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)"' |
################ copy/replace file to ~/.bash_aliases | |
################ Tuning bash ########################################################################################### | |
# Command line history | |
export HISTCONTROL=ignoredups:ignorespace | |
export HISTFILESIZE=10000000 | |
export HISTSIZE=1000000 | |
shopt -s histappend # Append to the history file, don't overwrite it | |
shopt -s checkwinsize # Check the window size after each command and, if necessary, update the values of LINES and COLUMNS. |
// | |
export function toArray(arr = []) { | |
return Array.prototype.slice.call(arr, 0); | |
} | |
// | |
export function mergeOptions(obj1, obj2) { | |
var merged = {}; | |
for (var attrname in obj1) { merged[attrname] = obj1[attrname]; } | |
for (var attrname in obj2) { merged[attrname] = obj2[attrname]; } |
/** | |
(prototype that explains method`s logic) | |
Usage: | |
<a href="somewhere" class="with-tooltip" data-tooltip="Всплывашка">A href</a> | |
*/ |