Tuesday, July 31, 2012

ctrl+tab style tabs in gvim

Forget where i first saw this but here it is, the win7 vim path is currently
C:\Program Files (x86)\Vim
and inside this folder the file _vimrc should have these lines 

:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
:nmap <C-t> :tabnew<cr>
:imap <C-t> <ESC>:tabnew<cr> 

After this change, restart vim, hit ctrl+tab, enjoy.

Monday, March 5, 2012

Big O

Quick and dirty explanation of Big O. Interesting for someone like myself w/o a huge math background.
http://c2.com/cgi/wiki?BigOh

Monday, February 20, 2012

Ruby (and rails)

So I've decided to learn Ruby and Rails. Just some links I've found useful in getting started.

Of course there is all the *nix/win32 env install crap, rvm seems to be THE choice, and since I'm using linux, it's easy enough.

Good entry point for a web developer.

A cross platform textmate like editor that may be worth looking into.

Further reading

Neat for the lazy learner. Threads are short here but interesting.

Comming with considerable php experience this was nice to see how CGI has been plugged into Ruby (Ruby->Rack->Rails)

more to come ...

Sunday, February 19, 2012

Bash string replace

I was using sed for template substitution recently and it seemed that no matter what regex delimiter I chose, that char existed in the template and caused my template population (sed replace) to fail. Fortunately bash has string substitution built right in, albeit with some slightly strange syntax.

# replace all @ chars with \@
x=${x//@/\\@}

now we can freely sub in values for our template variables w/o having to worry if they contain @ characters

#$1 = file name
#$2 = template variable name
sed -i s@$2@$x@g templates/$1