This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# References: | |
# GRML - https://github.com/grml/grml-etc-core | |
# zsh-users - https://github.com/zsh-users | |
[[ $ZDOTDIR == '' ]] && export ZDOTDIR=$HOME | |
if [[ $ZDOTDIR == '/etc/users/bootleq' && -f $ZDOTDIR/.vimrc ]]; then | |
alias vim="vim -u $ZDOTDIR/.vimrc" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = bootleq | |
email = bootleq@gmail.com | |
[color] | |
ui = auto | |
; [help] | |
; format = web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionController | |
class Metal | |
attr_internal :cached_content_for | |
end | |
module Caching | |
module Actions | |
def _save_fragment(name, options) | |
return unless caching_allowed? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rtouch() { | |
emulate -L zsh | |
if [[ -d tmp ]]; then | |
if which passenger 2>&1 >/dev/null; then | |
touch tmp/restart.txt && echo 'file touched.' | |
elif which unicorn_rails 2>&1 >/dev/null; then | |
if [[ -r tmp/pids/unicorn.pid && -n $(ps h -p `cat tmp/pids/unicorn.pid` | tr -d ' ') ]]; then | |
kill -USR2 $(cat tmp/pids/unicorn.pid) && echo "process killed." | |
elif [[ -f config/unicorn.rb ]] && [[ -n $RAILS_ENV ]]; then | |
bundle exec unicorn_rails -D -E $RAILS_ENV -c config/unicorn.rb && echo "process started." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" First, install thinca/vim-quickrun | |
" | |
" https://github.com/thinca/vim-quickrun | |
" | |
" Then write some vimrc: | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sshAgentFind() { | |
# Ref https://github.com/wwalker/ssh-find-agent | |
local -a sockets | |
if [[ -z "$SSH_AUTH_SOCK" ]] ; then | |
sockets=("${(@f)$(find /tmp/ -type s -path '/tmp/ssh-*/agent.*' -user $USER)}") | |
for socket in $sockets; do | |
SSH_AUTH_SOCK=$socket ssh-add -l 2> /dev/null > /dev/null | |
if [[ $? -eq 0 ]]; then | |
export SSH_AUTH_SOCK=$socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" TODO when no keyword is under/after the cursor, try looking backward to find a word. | |
fun! WordTransform() | |
let w = expand("<cword>") | |
let x = '' | |
let c = strpart(getline('.'), col('.') - 1, 1) | |
if match(w, '_') > -1 | |
let x = substitute(w, '_\([a-z]\)', '\u\1', 'g') | |
else | |
let x = substitute(w, '\C[A-Z]', '_\L\0', 'g') | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim color file | |
" Maintainer: bootleq <bootleq@gmail.com> | |
" Last Change: 2010-09-17 | |
" Version: 0.2 | |
" | |
" Summary: | |
" Modified from "slate" theme in 256 color term. | |
" Dark background, high contrast, similar color in cterm/gui, and avoid bold attribute in gui. | |
" | |
" Test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! -bang -nargs=* JsCompress call JsCompress(<bang>0, <f-args>) | |
" @param boolean save 0: save to temp file and return compressed content. | |
" 1: save with alternative filename, return the new name. | |
" @param boolean interact 1 to prompt before starting compression. | |
" @param string options extra options for running the compiler. | |
fun! JsCompress(save, ...) | |
let jar = '/scripts/google-compiler-20100616.jar' | |
let defaults = ' --compilation_level=SIMPLE_OPTIMIZATIONS' | |
\ . ' --warning_level=QUIET' | |
let input = expand('%') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! -nargs=* Bookmarklet call Bookmarklet(<f-args>) | |
fun! Bookmarklet(...) | |
let result = JsCompress(0, 0, '--compilation_level=WHITESPACE_ONLY') | |
if len(getqflist()) == 0 && strlen(result) > 0 | |
let reuse_win = 0 | |
for winnr in tabpagebuflist(tabpagenr()) | |
if bufname(winnr) == '[Bookmarklet]' | |
exec winnr . 'wincmd w' | |
let reuse_win = winnr | |
endif |
OlderNewer