Skip to content

Instantly share code, notes, and snippets.

View ajorgensen's full-sized avatar

Andrew Jorgensen ajorgensen

View GitHub Profile
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#)))
@ajorgensen
ajorgensen / gist:7833049
Last active December 30, 2015 12:59
Pass predicate
(def predicate `(< 3 "?a"))
(def data [[1] [2] [3] [4]])
(defmacro foo
[data predicate]
`(<- ["?a"]
(data :> "?a")
(~@predicate)))
(?- (stdout) (foo data (eval predicate))) ;doesn't work
an not find /Users/ajorgensen/.sbt/boot/scala-2.9.3/lib/scala-library.jar appending SBT_VERSION [0.12.0] to SBT_HOME
./scripts/scald.rb:146: warning: already initialized constant SBT_HOME
./scripts/scald.rb:147: warning: already initialized constant SCALA_LIB_DIR
compiling ./scalding-core/src/main/scala/com/twitter/scalding/examples/WordCountJob.scala
scalac -classpath /var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/hadoop-core-1.1.2.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/commons-codec-1.8.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/commons-configuration-1.9.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/jackson-asl-0.9.5.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/jackson-mapper-asl-1.9.13.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/slf4j-log4j12-1.6.6.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/log4j-1.2.15.jar:/var/folders/l_/_j2v6hdd63vbnkxf6ffjvcxc0000gn/T/maven/commons-httpclient-3.1.jar:/var/folders/l_/_j
options:
--clean, -c: Clean all rsync and maven state before running
--cp, -p <s>: Scala classpath
--hdfs, -h: Run on HDFS
--hdfs-local, -d: Run in Hadoop local mode
--local, -l: Run in Cascading local mode (does not use Hadoop)
--print, -r: Print the command YOU SHOULD enter on the remote node. Useful for screen sessions
--scalaversion, -s <s>: version of Scala for scalac (defaults to scalaVersion in project/Build.scala)
--print-cp, -i: Print the Scala classpath
--jar, -j <s>: Specify the jar file
@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