Skip to content

Instantly share code, notes, and snippets.

Alex veirus

Block or report user

Report or block veirus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@veirus
veirus / autobrackets.vim
Created May 28, 2018
Simple function and mappings to close brackets automagically. In practice this shit is more irritating than helpful.
View autobrackets.vim
" Auto-insert closing parenthesis/brace {{{2
" TODO: make bracket insertion a little smarter
" right now it gets in the way more than it helps
inoremap ( ()<Left>
inoremap { {}<Left>
inoremap [ []<Left>
" Auto-delete closing parenthesis/brace
function! BetterBackSpace() abort
let cur_line = getline('.')
@veirus
veirus / switchvim.bat
Created May 14, 2018
Switch between two different .vim dirs on the fly - Windows version
View switchvim.bat
@echo off
if exist "%USERPROFILE%\vimfiles" ( if not exist "%USERPROFILE%\vimfiles_" (move "%USERPROFILE%\vimfiles" "%USERPROFILE%\vimfiles_") else (echo "0 -> _ failed, _ exists"))
if exist "%USERPROFILE%\vimfiles1" ( if not exist "%USERPROFILE%\vimfiles" (move "%USERPROFILE%\vimfiles1" "%USERPROFILE%\vimfiles") else (echo "1 -> 0 failed, 0 exists"))
if exist "%USERPROFILE%\vimfiles_" ( if not exist "%USERPROFILE%\vimfiles1" (move "%USERPROFILE%\vimfiles_" "%USERPROFILE%\vimfiles1") else (echo "_ -> 1 failed, 1 exists"))
@veirus
veirus / foldmarker_map.vim
Created May 13, 2018
Simple mapping to quickly insert default fold marker
View foldmarker_map.vim
nnoremap <expr> <leader><Tab> getline('.') =~ "\"" ? "m1A {{{1<Esc>`1" : "m1A \" {{{1<Esc>`1"
nnoremap <expr> <leader>1<Tab> getline('.') =~ "\"" ? "m2A }}}1<Esc>`2" : "m1A \" }}}1<Esc>`2"
inoremap <expr> <localleader><Tab> getline('.') =~ "\"" ? "<Esc>m1A {{{1<C-o>`1" : "<Esc>m1A\" {{{1<C-o>`1"
inoremap <expr> <localleader>1<Tab> getline('.') =~ "\"" ? "<Esc>m2A }}}1<C-o>`2" : "<Esc>m2A\" }}}1<C-o>`2"
@veirus
veirus / findmedia8.py
Created Mar 12, 2018
Findmedia.py - generate a (play)list of specified filetypes
View findmedia8.py
#!/usr/bin/env python3
'''Findmedia - generate a (play)list of specified filetypes'''
import os
__revision__ = '8'
vidia = ('3gp', 'AVI', 'VOB', 'WMV', 'wmv', 'avi', 'flv', 'mka', 'mkv',
'mov', 'mp4', 'mpeg', 'mpg', 'vob', 'ogm')
newformats = ('webm')
@veirus
veirus / com.bat
Created Jan 16, 2018
Moving pictures into corresponding dirs: batch file edition.
View com.bat
@echo off
if exist "*.jpg" (md ".\jpg\") && (move *.jpg ".\jpg\") && (move *.jpeg ".\jpg\") ELSE (echo no jpg)
if exist "*.tga" (md ".\tga\") && (move *.tga ".\tga\") ELSE (echo no tga)
if exist "*.bmp" (md ".\bmp\") && (move *.bmp ".\bmp\") ELSE (echo no bmp)
if exist "*.gif" (md ".\gif\") && (move *.gif ".\gif\") ELSE (echo no gif)
if exist "*.psd" (md ".\psd\") && (move *.psd ".\psd\") ELSE (echo no psd)
if exist "*.png" (md ".\png\") && (move *.png ".\png\") ELSE (echo no png)
@veirus
veirus / dror5.py
Last active May 14, 2018
DROR updated for Python 3.6
View dror5.py
#!/usr/bin/env python3.6
# dror - datetime format edition
# Based on https://gist.github.com/dansku/9040240#file-dropboxorganize-py
# 2018-05-14: convert to Pathlib; remove .encode('utf-8'); add alt output template
__verstion__ = '0.5.2'
import os.path
import glob
from datetime import date
from pathlib import Path
@veirus
veirus / switchdict.py
Created Dec 25, 2017
dict instead of switch block
View switchdict.py
def a():
print("a")
def b():
print("b")
def default():
print("default")
@veirus
veirus / search.css
Created Dec 13, 2017
Search input custom element. Also works well with wp
View search.css
/* header__search {{{3 */
/* use postcss-next */
&__search {
text-align: right;
cursor: pointer;
position: relative;
@nest & .screen-reader-text {
position: absolute;
left: -9999px;
top: -99999px;
View header__contacts.php
<div class="header__contacts col-9 col-m-12">
<div class="col-8 col-m-12">
<?php $_phone = get_field('site_phone', 'options');
$_tel = preg_replace("/[^0-9]/", "", $_phone); ?>
<p><a href="tel:+<?php echo $_tel;?>" class="phone"><?php echo $_phone; ?></a></p>
<p><?php the_field('site_adress', 'options'); ?></p>
</div>
<div class="col-4 col-m-12 header__btns"><a class="btn js-mopen" href="#modal">Заказать консультацию</a></div>
</div>
View wp_setup_acf_options.php
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'menu_title' => 'Настройки контента',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
//'icon_url' => '/wp-content/themes/tt_landing/favicon.png',
'post_id' => 'options',
'position' => 2,
'redirect' => true
));
You can’t perform that action at this time.