Skip to content

Instantly share code, notes, and snippets.

View sadovnik's full-sized avatar

Cyril Sadovnik sadovnik

  • тута здеся
View GitHub Profile
@sadovnik
sadovnik / isEmbedded.js
Last active December 10, 2015 18:17
Проверка на айфрейм
function isEmbedded () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
@sadovnik
sadovnik / gist:5ca82df236c9f0fd38c3269a94a88f6d
Created June 16, 2016 15:58
Fix dos linebreaks to unix using vim
%s/\r/\r/g
@sadovnik
sadovnik / reinstall.sh
Created June 25, 2016 16:24
Reinstall npm packages
rm -rf ~/.npm/
rm -rf node_modules/
npm cache clean
npm cache clear
npm install
@sadovnik
sadovnik / osm-poi-type-map.json
Created October 3, 2016 15:54
Карта соответствий типов POI к значению на русском
{
"accountant": "Бухгалтерские услуги",
"administrative": "Административное учреждение",
"advertising": "Реклама",
"advertising_agency": "Рекламное агентство",
"advertising_billboard": "Биллборд",
"advertising_column": "Колонна",
"advertising_flag": "Флаг",
"advertising_screen": "Экран",
"advertising_sculpture": "Скульптура",
@sadovnik
sadovnik / set_swap.sh
Created December 6, 2016 11:34
Set swap (useful for Vagrant machines)
#!/bin/sh
# size of swapfile in megabytes
swapsize=2048
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@sadovnik
sadovnik / env_nginx.conf
Created February 6, 2017 12:49
How to pass an environment variable from Nginx to PHP
location ~ \.php$ {
# Variable FOO_ENV_VARIABLE with value "bar"
fastcgi_param FOO_ENV_VARIABLE bar;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
@sadovnik
sadovnik / gist:7614ed390a7f1db38abe520a1b5eb609
Created February 17, 2017 18:59
Git: replace commit author name and email on every commit that matches
git filter-branch --env-filter '
oldname="Cyril"
oldemail="old.email@example.com"
newname="Cyril Sadovnik"
newemail="new.email@example.com"
[ "$GIT_AUTHOR_EMAIL" = "$oldemail" ] && GIT_AUTHOR_EMAIL="$newemail"
[ "$GIT_COMMITTER_EMAIL" = "$oldemail" ] && GIT_COMMITTER_EMAIL="$newemail"
[ "$GIT_AUTHOR_NAME" = "$oldname" ] && GIT_AUTHOR_NAME="$newname"
[ "$GIT_COMMITTER_NAME" = "$oldname" ] && GIT_COMMITTER_NAME="$newname"
' head
@sadovnik
sadovnik / nvim-python-match-tag-always.md
Last active April 19, 2021 05:09
neovim nvim MatchTagAlways error fix

If you get this error when open neovim:

$ nvim

MatchTagAlways unavailable: requires python.
Press ENTER or type command to continue

Try to install neovim package:

@sadovnik
sadovnik / ssh_add_memo.md
Last active November 8, 2017 15:34
git stderr: Permission denied (publickey)
ssh-add ~/.ssh/id_rsa
@sadovnik
sadovnik / lol-commits-post-commit-hook.sh
Created November 9, 2017 11:41
lolcommits `.git/hooks/post-commit` configuration resolving black photo issue
#!/bin/sh
### lolcommits hook (begin) ###
LANG="en_US.UTF-8" && PATH="/Users/cyril/.rbenv/versions/2.3.5/bin:/usr/local/bin:$PATH" && if [ ! -d "$GIT_DIR/rebase-merge" ] && [ "$LOLCOMMITS_CAPTURE_DISABLED" != "true" ]; then lolcommits --capture --delay 1 --stealth --fork; fi
### lolcommits hook (end) ###