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 "matrix" | |
#First, you construct an adjacency matrix. An adjacency matrix is just a matrix of what is linking to what. | |
#[0, 1, 1, 1, 1, 0, 1] | |
#[1, 0, 0, 0, 0, 0, 0] | |
#[1, 1, 0, 0, 0, 0, 0] | |
#[0, 1, 1, 0, 1, 0, 0] | |
#[1, 0, 1, 1, 0, 1, 0] | |
#[1, 0, 0, 0, 1, 0, 0] |
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
def select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
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
class window.DataToggle | |
get: (str) -> | |
$("##{str}") | |
ids: (type, e) -> | |
$(e).attr("data-#{type}").split(' ') | |
constructor: -> | |
_self = @ | |
_self.data_show(_self, $(e).parent()) for e in $('[data-show]') | |
_self.data_hide(_self, $(e).parent()) for e in $('[data-hide]') |
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
RSpec::Matchers.define :inherit_from do |superclass| | |
match do |klass| | |
klass.class.ancestors.include? superclass | |
end | |
failure_message_for_should do |klass| | |
"expected #{klass.class.name} to inherit from #{superclass}" | |
end | |
failure_message_for_should_not do |klass| |