Skip to content

Instantly share code, notes, and snippets.

View digitalhitler's full-sized avatar

Sergey S Petrenko digitalhitler

View GitHub Profile
@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в 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, ['найдена', 'найдено', 'найдены']);
@hwdsl2
hwdsl2 / .MOVED.md
Last active May 19, 2024 06:28
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@MartinMuzatko
MartinMuzatko / README.MD
Last active July 10, 2016 20:11
Riot Mixin - Smooth exit animation for your data - interact.js
@digitalhitler
digitalhitler / gulpfile.js
Created December 6, 2015 20:10
GulpBoss: gulpfile.js with extendable plugins, less, css, js, browserify, minify-uglify-anythingyouwantfy
/**
* gulpfile.js
*
* Gulp BOSS 8-)
*
* Удобный (для меня) способ компилировать всё в Gulp-е.
* Всякие ништяки included.
*
* Made by http://github.com/digitalhitler
*
@digitalhitler
digitalhitler / configure.sh
Last active October 8, 2016 13:11
CentOS Proxmox Dev Machine Auto-Configurator
#!/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
@strizhechenko
strizhechenko / porno.md
Last active June 13, 2023 19:24
Код ниже генерирует прекрасные названия, не знаю для чего, новые жанры порно или названия программных проектов.
#!/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
@digitalhitler
digitalhitler / git-grog.sh
Created January 8, 2017 00:48
Git Graphical Log Alias - `git grog`
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.
@digitalhitler
digitalhitler / xhr-fetch.js
Created May 8, 2017 10:45
JS Fetch & XHR Tools
//
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]; }
@digitalhitler
digitalhitler / css-tooltips.css
Created September 12, 2017 22:09
Pure CSS tooltips
/**
(prototype that explains method`s logic)
Usage:
<a href="somewhere" class="with-tooltip" data-tooltip="Всплывашка">A href</a>
*/