Skip to content

Instantly share code, notes, and snippets.

View kwstannard's full-sized avatar

Wolf kwstannard

  • Andros
  • New York City
View GitHub Profile
@kwstannard
kwstannard / LongLineHighlight
Created February 25, 2013 16:08
VIM long line highlighting
highlight LongLines guibg=#333300
au BufWinEnter * call matchadd('LongLines', '^.\{80,119}$', -1)
highlight VeryLongLines guibg=#330000
au BufWinEnter * call matchadd('VeryLongLines', '^.\{120,}$', -1)
@kwstannard
kwstannard / IndentHighlighting.vim
Created February 25, 2013 23:13
Indent highlighting
let indent_colors = ['#645640','#564832','#484024','#646452','#565644','#484834','#565656','#484848','#404040']
let indent = 8
for icolor in indent_colors
let indent_name = 'Indent' . indent
exec 'highlight ' . indent_name . ' guibg=' . icolor
au bufwinenter * call matchadd(indent_name, '^\s\{' . (indent * 2 + 4) . '}\&^\s\{' . (indent * 2 + 1) . '}', 200-indent)
let indent -= 1
endfor
@kwstannard
kwstannard / blockComments.vim
Created February 26, 2013 15:44
common line block commenting
" block select commenting & uncommenting
au BufEnter *.rb map ,c :s/^/#/<CR>:nohlsearch<CR>
au BufEnter *.rb map ,u :s/^#//<CR>:nohlsearch<CR>
au BufEnter *.vim* map ,c :s/^/"/<CR>:nohlsearch<CR>
au BufEnter *.vim* map ,u :s/^"//<CR>:nohlsearch<CR>
au BufEnter *.haml* map ,c :s/^/-#/<CR>:nohlsearch<CR>
au BufEnter *.haml* map ,u :s/^-#//<CR>:nohlsearch<CR>
@kwstannard
kwstannard / foo.md
Last active December 27, 2015 11:48

old view

<%= select_for_tag :name,
  options_for_select(complex.stuff.collect{|d| d.stuff} + ['other', 'stuff']) %>

new view

<%= select_for_tag :name,
  options_for_select(complex.stuff.collect{|d| d.stuff} + admin_selection_choices(user) + ['other', 'stuff']) %>
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
else
if [ -f ".ruby-version" ]; then
if [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
else
rvm use `cat .ruby-version`
#! /usr/bin/ruby
branch_match = `git branch`.match(/FY-#{ARGV[0]}\w+/)
branch = branch_match ? branch_match[0].to_s : ARGV[0]
`git checkout #{branch}`
package funsets
import common._
/**
* 2. Purely Functional Sets.
*/
object FunSets {
/**
* We represent a set by its characteristic function, i.e.
class OnCodeCaller
def self.call(code, needer)
if needer.respond_to?("on_#{code}")
needer.send("on_#{code}")
elsif needer.respond_to?("on_#{code / 100}XX")
needer.send("on_#{code / 100}XX")
else
needer.on_failure
end
end
describe 'ordering' do
let(:herp) { raise 'hi' }
subject { raise 'bye' }
it { should eq(herp) } #=> error 'hi'
it { is_expected.to eq(herp) } #=> error 'bye'
end
class RubyVersion
def self.current
factory.current
end
def self.factory
if version_file_exists?
Files.new
elsif rvm_present?
RVM.new