Skip to content

Instantly share code, notes, and snippets.

@bootleq
bootleq / imagery.xml
Created September 26, 2011 06:13
Search plugin for imagery - http://elzr.com/imagery/
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Imagery</os:ShortName>
<os:Description>Image search superpowers</os:Description>
<os:InputEncoding>utf-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAABEElEQVR4nGNgoAr4+//P3/9/sEoxovEvfdhy+8uhD7+fMTAwyHDpGQoEibGrICtgQVN9+v0KOPfJt0tPvl36+/8PMyMLdg23vxxiYGBwFM2R5zZhYGDY86pPkl0LWTW6Bh5WkQ+/n+1/PYXhNVREkl0Lzc1MyBxDgSABVilMO3HaAPEfJHyuftxx+v0KHlYRNA3ooXTvy4nzH9ZBQomBgcFXqgFfKL36eWfzswZkkcOvZ+Hzw4vvNxgYGARYpRIUFoTK9DIwMHz4/ezVzzs4NSADbhZhtADA4iQJTg2G9wwffj9b8CABIiLAKoXmBxQbzn9YB1EE4cpw6QVIt+FyAgMDA8On3y93vuxiwJv4SAYAplFkpcAGHAAAAAAASUVORK5CYII=</os:Image>
<UpdateInterval>7</UpdateInterval>
<IconUpdateUrl>http://elzr.com/images/imagery/favicon.ico</IconUpdateUrl>
<SearchForm>http://elzr.com/imagery</SearchForm>
<os:Url type="text/html" method="GET" template="http://elzr.com/imagery">
<os
@bootleq
bootleq / gist:1242220
Created September 26, 2011 13:23
Old way to toggle words, I no longer use it.
" }}}2 ToggleTextOption {{{2
" http://vim.wikia.com/wiki/Toggling_yes-no
function! ToggleTextOption()
let w = expand("<cword>")
call RegStash(1, '"') | normal yl
let c = @" | call RegStash(0, '"')
let pairs = [
\ ["true", "false"],
@bootleq
bootleq / gist:1286366
Created October 14, 2011 06:04
ToggleTreeStyleTab for keyconfig
if (typeof gBrowser.treeStyleTab !== 'undefined') {
var ah = gBrowser.treeStyleTab.autoHide;
if (ah.expanded) {
ah.hide(ah.kSHOWN_BY_SHORTCUT);
} else {
ah.show(ah.kSHOWN_BY_SHORTCUT);
}
}
// issue: wrong splitter position when auto hide is not enabled.
@bootleq
bootleq / gist:1455020
Created December 10, 2011 12:15
Vim 陽春 google 字典,反正已經沒用了,google 停了這服務
nnoremap <silent> <LocalLeader>K :DictSearch<CR>
xnoremap <silent> <LocalLeader>K :<C-U>call SaveReg()<CR>gvy:let b:temp_reg=@"<CR>
\ :call RestoreReg()<CR>:call DictSearch(b:temp_reg)<CR>
command! -nargs=* DictSearch call DictSearch(<f-args>)
command! -nargs=0 DictSearchOff call <SID>dict_search_off()
function! DictSearch(...)
let save_isk = &l:iskeyword
let &l:iskeyword = '@'
let word = a:0 > 0 ? a:1 : expand('<cword>')
let mode = a:0 > 1 ? a:2 : ''
@bootleq
bootleq / gist:1489352
Created December 17, 2011 05:36
Vim 陽春 Dr.eye 字典,沒在用了,太慢
command! -nargs=* DictSearch call DictSearch(<f-args>)
" 來源:Dr.eye 字典 移動版
" 例: http://www.dreye.com/mws/dict.php?w=word&ua=dc_cont
let s:dict_search_modes = {
\ 'keys': ['cont', 'var', 'phra', 'diff', 'der' ],
\ 'values': ['字義', '變化', '片語', '辨析', '衍生']
\ }
function! DictSearch(...)
let word = a:0 > 0 ? a:1 : ''
@bootleq
bootleq / upgrade_vim.sh
Created April 4, 2012 03:24
Install/upgrade Vim from source
#!/bin/bash
# 安裝相依套件
apt-get install mercurial
apt-get install exuberant-ctags
# 取得 vim source
cd /usr/local/src
@bootleq
bootleq / _capistrano.zsh
Created June 9, 2012 00:35
zsh capistrano completeion function
#compdef cap
#autoload
# From zsh-users (https://github.com/zsh-users/zsh-completions)
# Mix with oh-my-zsh pull request #367 (https://github.com/robbyrussell/oh-my-zsh/pull/367)
_cap() {
local curcontext="$curcontext" state line cmds ret=1
local cache_file='tmp/.cap_tasks~'
# TODO use zsh built-in cache instead of cache_file
#!/usr/bin/env ruby
require 'rubygems'
require 'redis'
require 'active_support/core_ext/hash'
require 'optparse'
require 'yaml'
require 'pp'
options = {}.with_indifferent_access
@bootleq
bootleq / moedict-tw.xml
Created April 28, 2013 15:28
萌典 OpenSearch plugin
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>萌典</ShortName>
<Description>教育部國語詞典(民間線上版)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">https://www.moedict.tw/favicon.ico</Image>
<Url type="text/html" method="GET" template="https://www.moedict.tw/#{searchTerms}"></Url>
</OpenSearchDescription>
@bootleq
bootleq / .zshrc
Created May 19, 2013 07:57
zsh alias for ag
() {
# TODO --hidden
local common='noglob ag --nobreak --nogroup --noheading --smart-case --depth=27'
local colors='--color-path 35 --color-line-number 32 --color-match "1;31"'
alias ag=$common' '$colors
alias agjs=$common' '$colors' -G public/javascripts/.*-(debug|src).js'
}