Skip to content

Instantly share code, notes, and snippets.

@drasill
drasill / bspwmrc
Last active November 3, 2022 10:29
bspwm : External Rules & Config for right-stacked windows
#! /bin/sh
# ~/.config/bspwm/bspwmrc
#...
bspc config external_rules_command ~/.config/bspwm/scripts/external_rules.sh
@drasill
drasill / QIcon.js
Created March 21, 2019 10:23
QIcon override for svg
const prefix = process.env.THEME === 'mat' ? 'md' : 'ios'
export default {
name: 'QIcon',
props: {
name: String,
color: String,
size: String
},
computed: {
@drasill
drasill / test.php
Created June 12, 2018 12:54
Bootstrap laravel app
<?php
namespace App;
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(\Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
\DB::statement("...");
@drasill
drasill / search-inside.vim
Created November 28, 2017 09:41
Search inside/outside syntax
function! SearchWithSkip(pattern, flags, stopline, timeout, skip)
"
" Returns true if a match is found for {pattern}, but ignores matches
" where {skip} evaluates to false. This allows you to do nifty things
" like, say, only matching outside comments, only on odd-numbered lines,
" or whatever else you like.
"
" Mimics the built-in search() function, but adds a {skip} expression
" like that available in searchpair() and searchpairpos().
" (See the Vim help on search() for details of the other parameters.)
@drasill
drasill / vim-php-function-object.vim
Last active November 28, 2017 09:38
PHP function textobject
call textobj#user#plugin('phpfunction', {
\ '-': {
\ 'select-a-function': 'CurrentPhpFunctionA',
\ 'select-a': 'af',
\ 'select-i-function': 'CurrentPhpFunctionI',
\ 'select-i': 'if',
\ },
\ })
function! CurrentPhpFunctionI()
@drasill
drasill / change_ratio.sh
Created October 25, 2016 09:08
bspwm: Change resize ratio of current focused node (or node's parent)
#!/bin/sh
# Get the current non-leaf focused node
NODE=$(bspc query -N -n focused.\!leaf)
if [ $? -ne 0 ]; then
# No non-leaf, then select parent of focused node
NODE=$(bspc query -N -n @parent)
fi
@drasill
drasill / search-in-syntax.vim
Last active May 25, 2016 09:48
vim: search only inside/outside syntax type
" http://stackoverflow.com/questions/2683521/vim-search-in-c-c-code-lines
function! SearchWithSkip(pattern, flags, stopline, timeout, skip)
"
" Returns true if a match is found for {pattern}, but ignores matches
" where {skip} evaluates to false. This allows you to do nifty things
" like, say, only matching outside comments, only on odd-numbered lines,
" or whatever else you like.
"
" Mimics the built-in search() function, but adds a {skip} expression
@drasill
drasill / fasd-fzf.zsh
Created November 23, 2015 08:52
Fast Jump : Ctrl-J with Fasd + FZF
# With FASD and FZF installed
# CTRL-J - Fasd fast jump
fzf-fasd-widget() {
local cmd="${FZF_ALT_C_COMMAND:-"command fasd -Rdl"}"
cd "${$(eval "$cmd" | $(__fzfcmd) +m):-.}"
zle reset-prompt
}
zle -N fzf-fasd-widget
bindkey '^J' fzf-fasd-widget
@drasill
drasill / vim-fzf-git-ls-files.vim
Created November 19, 2015 09:03
vim : git ls-file + fzf
function! s:escape(path)
return substitute(a:path, ' ', '\\ ', 'g')
endfunction
function! GitLsHandler(line)
execute 'e '. s:escape(a:line)
endfunction
command! -nargs=* Fgl call fzf#run({
\ 'source': 'git ls-files -o -c --exclude-standard "<args>"',
function! s:escape(path)
return substitute(a:path, ' ', '\\ ', 'g')
endfunction
function! GitGrepHandler(line)
let parts = split(a:line, ':')
let [fn, lno] = parts[0 : 1]
execute 'e '. s:escape(fn)
execute lno
normal! zz