Skip to content

Instantly share code, notes, and snippets.

@Phize
Phize / tree.diag
Created December 9, 2011 05:48
Directory / File tree with blockdiag.
diagram {
default_fontsize = 13; // default value is 11
default_linecolor = "#999"; // default value is black
node_width = 64; // default value is 128
node_height = 20; // default value is 40
span_width = 16; // default value is 64
span_height = 10; // default value is 40
// classes for node.
class folder [color = "#fc0", linecolor = "#c90"];
@Phize
Phize / .vimrc
Created December 28, 2011 12:57
Vim: CSS tag list with Ctags (patched) + Tagbar plugin.
" Ctags (patch): http://designtomarkup.com/vim/taglist-ctags-css-patch
" Tagbar : https://github.com/majutsushi/tagbar
" Screenshot : http://twitpic.com/7zq4d7
"Tagbar
noremap <silent> <Leader>t :<C-u>TagbarToggle<CR>
let g:tagbar_type_css = {
\ 'ctagstype' : 'Css',
\ 'kinds' : [
@Phize
Phize / keyword.rb
Created December 28, 2011 17:03 — forked from jugyo/keyword.rb
keyword plugin for Earthquake(Ruby based Twitter client)
# keyword plugin
# ====
#
# config example:
#
# Earthquake.config[:keyword] = {:pattern => /ruby|rails|earthquake/i}
#
Earthquake.init do
_ = config[:keyword] ||= {}
_[:notify] = true if _[:notify].nil?
@Phize
Phize / 50-unite.vim
Created January 14, 2012 07:48
Vim statusline for Unite.vim with vim-powerline.
call Pl#Statusline(
\ Pl#Match('bufname("%")', '^\*unite\* - .*\@\d+$'),
\
\ Pl#Segment(' %{"Unite"} ',
\ Pl#HiCurrent( Pl#FG(231), Pl#BG(240), Pl#Attr('bold')),
\ Pl#HiInsert( Pl#FG(231), Pl#BG( 31), Pl#Attr('bold')),
\ Pl#HiNonCurrent(Pl#FG(244), Pl#BG(234), Pl#Attr('bold'))
\ ),
\
\ Pl#Segment('%< %{substitute(bufname("%"), "\^\\v\\*unite\\* - \(\.\+\)\\@\\d\+\$", "\\u\\1", "")} list',
@Phize
Phize / 50-ref.vim
Created January 14, 2012 10:32
Vim statusline for ref.vim with vim-powerline.
autocmd BufFilePost \[ref-*:*\] call Pl#UpdateStatusline(1)
call Pl#Statusline(
\ Pl#Match('bufname("%")', '^\[ref-(.+):(.*)\]$'),
\
\ Pl#Segment(' %{"Ref"} ',
\ Pl#HiCurrent( Pl#FG(231), Pl#BG(240), Pl#Attr('bold')),
\ Pl#HiInsert( Pl#FG(231), Pl#BG( 31), Pl#Attr('bold')),
\ Pl#HiNonCurrent(Pl#FG(244), Pl#BG(234), Pl#Attr('bold'))
\ ),
@Phize
Phize / .vimrc
Created January 15, 2012 11:15
Vim plugins which I used (a part of my .vimrc)
My Vim files have moved to https://github.com/Phize/vim
@Phize
Phize / .vimrc
Created February 1, 2012 08:25
align comment(s) with Align Them All! plugin on Vim.
" return regexp pattern that matches a comment based on commentstring.
function! s:getCommentStringPattern()
let pattern = escape(&commentstring, '^$[].*\~ ')
let pattern = substitute(pattern, '%s', '.*', 'g')
return pattern
endfunction
" align comment(s) based on commentstring.
autocmd vimrc-autocmd BufEnter *
@Phize
Phize / .vimrc_local
Created February 2, 2012 09:05
Vim: switching github accounts for Gist.vim
" **************************************************
" Gist {{{
" **************************************************
" dictionary of Gist accounts.
let g:gist_accounts = {
\ 'user1': {
\ 'password': 'password'
\ },
\ 'user2': {
\ 'password': 'password'
@Phize
Phize / gist:2218076
Created March 27, 2012 17:13
Bash function to get Git repository' basename.
function git_repository_basename() {
local _repository_basename
if [ $(git rev-parse --is-bare-repository) = 'true' ]; then
_repository_basename=$(basename $(git rev-parse --show-toplevel))
_repository_basename=${_repository_basename%.git}
else
_repository_basename=$(basename $(readlink -nf $(git rev-parse --show-toplevel)))
fi
@Phize
Phize / feednews.php
Created April 29, 2012 12:56
PHPTAL: a PHPTALES to check if a value exists and is not empty string.
function phptal_tales_notEmpty($src, $nothrow) {
$src = trim($src);
if (ctype_alnum($src)) return 'isset($ctx->' . $src . ') && "" !=== $ctx->' . $src;
return '(null !== ($path = $ctx->path($ctx,' . PHPTAL_Php_TalesInternal::string($src) . ', true)) && "" !== $path)';
}