Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Fullstory
  • Dallas, TX
View GitHub Profile
@cstrahan
cstrahan / MapKata.txt
Created July 12, 2011 17:51 — forked from mattflo/MapKata.txt
Map Kata
Map Kata
========
* Given a simple grid, e.g. 10x10
* Given a game piece is placed somewhere on the grid, e.g. 5,5
* Given the piece canNOT be moved diagonally, e.g. one up, one left...
* Find all available squares the piece can move to in
** 1 move
** 2 moves
** etc...
** until you are thrilled with your solution or ready for something new
#!/usr/bin/env bash
#
# Supported Operating Systems:
#
# - Arch Linux
# - RedHat Based (CentOS, ...)
# - Debian Based (Ubuntu, ...)
#
@cstrahan
cstrahan / gist:1975217
Created March 4, 2012 22:49
Emacs Sr Speedbar
(require 'sr-speedbar)
(setq speedbar-frame-parameters
'((minibuffer)
(width . 40)
(border-width . 0)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(unsplittable . t)
(left-fringe . 0)))
@cstrahan
cstrahan / chpwd_update_git_vars.sh
Created March 19, 2012 16:07 — forked from scelis/chpwd_update_git_vars.sh
Add git information to your ZSH prompt.
update_current_git_vars

Idiot-Proof Git Aliases

inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
@cstrahan
cstrahan / tabularize.vim
Created April 5, 2012 22:08 — forked from AndrewRadev/tabularize.vim
Tabularize mappings for specific use cases
" Tabularize mappings
"
" sa= -- align by equals
" sa> -- align by "=>"
"
" and so on. Note that any character can be entered and the mappings will
" attempt to align by that, in the simplest way possible.
"
" sa| -- equivalent to ":Tab/|"
"
@cstrahan
cstrahan / tabularize.vim
Created April 10, 2012 02:39 — forked from AndrewRadev/tabularize.vim
Tabularize mappings for specific use cases
" Tabularize mappings
"
" sa= -- align by equals
" sa> -- align by "=>"
"
" and so on. Note that any character can be entered and the mappings will
" attempt to align by that, in the simplest way possible.
"
" sa| -- equivalent to ":Tab/|"
"
@cstrahan
cstrahan / pair.md
Created April 11, 2012 00:22 — forked from wm/pair.md
TMUX Pairing

SSH setup for remote pairing

If Animal and Fozzie wanted to pair on Animals machine and they both have access to shared.muppets.com then they could use the following setup

  • Animal will have the following in ~/.ssh/config
Host tunnel_from_muppets
  Hostname space.muppets.com
 RemoteForward 1235 localhost:22
@cstrahan
cstrahan / copy_rtf.vim
Created April 12, 2012 15:42 — forked from zerowidth/copy_rtf.vim
copy a vim buffer or selection as syntax-highlighted RTF to the clipboard
" copy the entire buffer or selected text as RTF
" inspired by https://github.com/dharanasoft/rtf-highlight
" but only uses commands available by default on OS X.
"
" To set html conversion options, :help TOhtml
" And, undocumented, to set the font used,
" let g:html_font="Your Preferred Font"
"
function! CopyRTF(line1,line2)
if !executable('textutil')