This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
###################################################################### | |
# Task: Describe a Turing machine that shifts the input string one | |
# space to the right and places the symbol ($) in the first location | |
# on the tape. | |
###################################################################### | |
# Enter values below for | |
# q_0 : the initial state (an int) | |
# q_a : the accept state (an int) | |
# q_r : the reject state (an int) | |
# delta : the transition function expressed as a dictionary |
This file contains hidden or 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
###################################################################### | |
# Describe a Turing Machine that decides the language | |
# {w | w has an equal number of 0s and 1} | |
###################################################################### | |
# Enter values below for | |
# q_0 : the initial state (an int) | |
# q_a : the accept state (an int) | |
# q_r : the reject state (an int) | |
# delta : the transition function expressed as a dictionary | |
# with keys (state, symbol) and values (state, symbol, 'L' or 'R') |
This file contains hidden or 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
###################################################################### | |
# Task: Describe a two-tape Turing machine that decides the | |
# language {x#y | x is a substring of y and x,y in {0,1}^* } | |
###################################################################### | |
# Enter values below for | |
# q_0 : the initial state (an int) | |
# q_a : the accept state (an int) | |
# q_r : the reject state (an int) | |
# delta : the transition function expressed as a dictionary | |
# with keys (state, symbol, symbol) and |
This file contains hidden or 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('mongo') | |
def client | |
@client ||= Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'network-dev') | |
end | |
def actions | |
client[:actions] | |
end |