Skip to content

Instantly share code, notes, and snippets.

@gmarik
gmarik / test.vim
Created September 20, 2011 19:14
Unite fuzzy search
:Unite file
1) Expecting to fuzzy match config/database.yml (as Command-T does)
Sources: file
> dbyml
- [new file]dbyml
Sources: file
@gmarik
gmarik / route length chart
Created August 10, 2011 21:24
rails routes length chart
$ rake routes|ruby -ne '$_ =~ /^\s+([a-z_]+)/; puts "%-2s %s" % [$1.to_s.size, $1.to_s.gsub(/./,"*")]'|grep -v '^0'|sort -unr
92 ********************************************************************************************
91 *******************************************************************************************
90 ******************************************************************************************
89 *****************************************************************************************
88 ****************************************************************************************
87 ***************************************************************************************
85 *************************************************************************************
82 **********************************************************************************
@gmarik
gmarik / output
Created June 8, 2011 05:05
results
whose-bug$ bundle exec ruby test.rb
{
}
" Modularized configuration for vim
" Randy Morris <randy.morris@archlinux.us>
" Plugins
if v:version < 700
finish
endif
" {{{ Vundle setup
@gmarik
gmarik / game_of_life.rb
Created May 14, 2011 21:31
coderetreat wpg
class Cell
end
class World
def initialize
@x = 50
@y = 50
end

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

What's new

Bundle! command

Bundle! 'my_plugin'

instructs Vundle that

  1. this plugin should not be synchronized/cloned
  2. it's located in bundles/my_plugin
syntax on
set nocompatible " Unset compatibility with VI, it's 2011!
set wildmenu
set wildmode=list:longest " make cmdline tab completion similar to bash
set backup " Activate backup stuff
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set showmatch " Show matching brackets
@gmarik
gmarik / c-xc-s.vim
Created April 14, 2011 04:08
vim-starter-kit
nnoremap <silent> <special> <C-x><C-s> :if expand("%") == ""<Bar>browse confirm update<Bar> else<Bar>confirm update<Bar>endif<CR>
vmap <special> <C-x><C-s> <Esc><D-s>gv
imap <special> <C-x><C-s> <C-O><D-s>
cmap <special> <C-x><C-s> <C-C><D-s>
omap <special> <C-x><C-s> <Esc><D-s>
@gmarik
gmarik / curl.cmd
Created April 11, 2011 02:40 — forked from morhetz/curl.cmd
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%