This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
augroup vimrc | |
set hlsearch | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set ruler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We are doing something like this in several places | |
$("#student_id").bind("keypress", function(e){ | |
if (e.keyCode == 13){ | |
jQuery("#student_submit").parent().parent('form')[0].submit(); | |
return false; | |
} | |
}); | |
// The following are a couple of approaches to encapsulate this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_deleted { | |
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-" | |
} | |
function parse_git_added { | |
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+' | |
} | |
function parse_git_modified { | |
[[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*" | |
} | |
function parse_git_dirty { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
augroup vimrc | |
set hlsearch | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
developers = %w{ arongray tmiller acsellers pho3nixf1re jzw benolee } | |
pairs = developers.sort.combination(2).to_a | |
sprint_assignments_without_double_duty = pairs. | |
combination(developers.length / 2). | |
to_a. | |
select{|assignments| assignments.flatten.uniq.length == developers.length} | |
sprint_assignments_with_unique_pairs = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'haml' | |
def line_counter(node) | |
script_filters = %w{ javascript erb plain } | |
if node.type == :filter && script_filters.include?(node.value[:name]) | |
lines_from_this_node = node.value[:text].split("\n").length | |
else | |
lines_from_this_node = 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'haml' | |
def line_counter(node) | |
decendants = node.children.map{|n| line_counter(n)} | |
if node.type == :filter && %w{ javascript erb plain }.include?(node.value[:name]) | |
me = node.value[:text].split("\n").length | |
else | |
me = 0 | |
end | |
sum(decendants) + me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../test_helper' | |
class RangeTest < ActiveSupport::TestCase | |
test "Range#coinsides_with?" do | |
range_1 = Time.zone.now..Time.zone.now | |
range_2 = range_1 | |
assert (range_1).coinsides_with?(range_2), <<-MESSAGE | |
Ranges should coincide but don't! | |
1 | | |
2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../test_helper' | |
class RangeTest < Test::Unit::TestCase | |
test <<-TEST do | |
Range#coinsides_with? | |
| | |
| | |
TEST | |
range = Time.zone.now..Time.zone.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class GF::Appointments::FooTest < ActiveSupport::TestCase | |
# In non-ActiveRecord classes that use Shoulda a subject must be | |
# defined to use the should dsl method. Otherwise it will try to | |
# instantiate a class based on the class name of the test, in this | |
# case it tries to instantiate GF::Appointments::Foo. This instantiation | |
# fails if the initializer has required parameters and may have other | |
# undesirable side effects. | |
subject { Object.new } |