Skip to content

Instantly share code, notes, and snippets.

View ajorgensen's full-sized avatar

Andrew Jorgensen ajorgensen

View GitHub Profile
@ajorgensen
ajorgensen / gist:9003976
Created February 14, 2014 16:17
Fill in missing title for Github pull request truncated filenames
$(function() {
$(".css-truncate-target").each(function(i, obj) {
$(this).attr('title', $(this).text());
});
});
#!/bin/bash
tmux has-session -t $1 2>/dev/null
if [ "$?" -eq 1 ]; then
tmux new -s $1
else
tmux attach -t $1
fi
@ajorgensen
ajorgensen / gist:5033c007362690d0ec03
Created May 21, 2014 21:21
Automagically run bundle exec
for fname in 'rspec' 'rails'
do
eval "${fname}() { bundle exec ${fname} }"
eval "${fname}!() { ${fname} }"
done
@ajorgensen
ajorgensen / gist:daba080a250ad7b27cf6
Created June 3, 2014 03:53
Simple example of react and coffeescript
data = [
{ first: 'Bruce', last: 'Wayne' },
{ first: 'Peter', last: 'Parker' },
{ first: 'Foo', last: 'Bar' }]
person = React.createClass
render: ->
(
(React.DOM.div {}, [
(React.DOM.h2 {}, [ "#{@props.last}, #{@props.first}" ])
### Keybase proof
I hereby claim:
* I am ajorgensen on github.
* I am ajorgensen (https://keybase.io/ajorgensen) on keybase.
* I have a public key whose fingerprint is D155 725D F971 E4D4 3CA0 3C9D B104 24F3 7FA5 6977
To claim this, I am signing this object:
call pathogen#runtime_append_all_bundles()
set runtimepath^=~/.vim/bundle/ctrlp.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VUNDLE CONFIGURATION
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
set splitright
map <leader>a :call OpenTestFile()<cr>
function! OpenTestFile()
let test_file = system("echo " . expand("%:t") . " | sed 's/\.rb/_test.rb/' | xargs find ./test -name | head -1")
exec ':vsp ' . test_file
endfunction
@ajorgensen
ajorgensen / gist:5999848
Created July 15, 2013 13:15
Remove trailing whitespace automatically in vim
if has("autocmd")
autocmd BufWritePre {*.rb,*.js,*.coffee,*.scss,*.haml,*.py,*.js} :call <SID>StripTrailingWhitespaces()
endif
nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
(defmapfn to-json [json_keys & args]
"Takes keys and values and emit json strings based on those key value pairs. The size of json_keys should be the same
size as args. Usage: (to-json ['foo' 'bar'] ?v1 ?v2 :> ?json)"
  (json/generate-string (zipmap json_keys args)))
=> fieldDeclaration must be the same size as the given values
(defmacro defdeprecated [old new]
`(defmacro ~old
[sym# & body#]
(println ~(format "Warning, %s is deprecated; use %s."
old
(resolve new)))
`(~'~new ~sym# ~@body#)))