Skip to content

Instantly share code, notes, and snippets.

function! TrimWhite()
let view = winsaveview()
silent! %s/\s\+$//e
silent! g/^[\n\s]*\%$/d
call winrestview(view)
endfunction
command! TrimWhite :call TrimWhite()
if !exists("trimwhite_au")
@nyarly
nyarly / .git_template-info-attributes
Last active August 29, 2015 14:10
Git whitespace
# Goes in ~/.git_template/info/attributes
*.js filter=trimwhite
*.rb filter=trimwhite
*.html filter=trimwhite
*.css filter=trimwhite
*.sass filter=trimwhite
*.scss filter=trimwhite
*.erl filter=trimwhite
#!/bin/env bash
file=$1
source=$2
commit_sha=$3
echo $file
echo $source
#exit if source == 'commit'
if git status --porcelain | grep '^\?'; then
echo "Error: These files are untracked. Add them to the repo or to .gitignore"
exit 1
fi
require 'spec_helper'
require 'find'
%w{lib app}.each do |subdir|
path = Rails.root.join(subdir)
puts "Requiring files under #{path}"
Find.find(path) do |path|
if File.file?(path) and %r{.*\.rb\z} =~ path
begin
@nyarly
nyarly / cmdline
Created June 20, 2014 18:46
Sketch for env driven executable dispatcher
> ln -s /usr/bin/ruby /usr/bin/env-dispatcher
> ln -s /usr/bin/go /usr/bin/env-dipatcher
> export RUBY_VERSION=1.9
> ruby -v
1.9.3 p666
Bundler 1.6.2
Ruby 2.0.0 (2013-11-22 patchlevel 353) [i686-linux]
Rubygems 2.0.14
GEM_HOME /home/judson/.gem/ruby/2.0.0
GEM_PATH /home/judson/.gem/ruby/2.0.0:/home/judson/.gem/ruby/2.0.0
Bundler settings
path
Set for your local app (/home/judson/ruby/LRD/MindSwarms/mindswarms/.bundle/config): "/home/judson/ruby/bundle-paths/rails3/lib"
bin
module RoadForest
module Utility
class ClassRegistry
#Extend a module with this in order to make it the registrar for a
#particular purpose.
#The top of a class heirarchy will make "register" immediately available
#to subclasses. Otherwise, classes can say Module::registry.add(name,
#self)
#
module Registrar
#!/bin/bash
branches=$(git branch --merged | egrep -v '(^[*])|(master)|(staging)|(production)')
echo $branches
for branch in $branches; do
echo Cleaning: $branch
#If we can delete the branch remotely, delete it locally
git push origin :$branch && git branch -d $branch
if [ $branch == "merging" ]; then
@nyarly
nyarly / vimrc
Created February 28, 2014 18:22
"set runtimepath=$HOME/.vim,$VIM/ultisnips,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$VIM/ultisnips/after,$HOME/.vim/after
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'nyarly/gundo'