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
Find my clj-ttt repository and 'fork' it. | |
Update the README in this repository to say "Erik was here". | |
Leave a commit message that says "Adding to README" | |
Copy the README file to a new file called "README-dup.md", add, then commit this new file with a message saying 'Cloned README'. | |
Copy the entire 'spec' directory from the repo into a directory called 'spec_clone', add, and commit this. | |
Submit a pull request to my original repository from a new branch in your repo called 'erik-test'. |
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
module FeatureAccess | |
def self.features_for_organization(organization_id) | |
end | |
def self.feature_on_for_organization(organization_id, feature_name) | |
end | |
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
# Example 1 | |
def kind_or_name(data_type) | |
if data_type.include? :kind | |
data_type[:kind] | |
else | |
data_type[:name] | |
end | |
end | |
# Example 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
def person(name) | |
{ | |
:name => name, | |
:type => :person | |
} | |
end | |
def birthday_person(name, birthday) | |
{ | |
:name => name, |
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 LinkedListReversal | |
def initialize(head) | |
@head = head | |
end | |
def reverse | |
last_node = nil | |
node = head | |
while node.next |
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
module Food | |
def edible? | |
true | |
end | |
end | |
class Apple | |
class << self | |
include Food | |
edible? # => NoMethodError: undefined method `edible?' for #<Class:Apple> |
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
module Foo | |
def edible? | |
true | |
end | |
end | |
class Apple | |
class << self | |
extend Foo | |
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 MinCut | |
attr_accessor :graph | |
def initialize(input) | |
@graph = Graph.new(input) | |
end | |
def min_cut | |
while graph.remaining_vertices.count > 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
2.1.1 :001 > a = [[1, 2], [2,3]] | |
=> [[1, 2], [2, 3]] | |
2.1.1 :002 > a.delete(1) | |
=> nil | |
2.1.1 :003 > a | |
=> [[1, 2], [2, 3]] | |
2.1.1 :004 > a.delete(1) | |
=> nil | |
2.1.1 :005 > b = [1, 2] | |
=> [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
def handle_source_response(stuff, klazz=StuffDoer) | |
klazz.new(stuff) if we_have_stuff? | |
end |