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
// What is an instance variable? | |
// An instance variable is the variable declared inside of the class but outside of the method. | |
class Shoe { | |
// these are all instance variables: | |
public String shoeBrand; | |
public String[] shoeSeason; | |
public int shoeSize; | |
// getters and setters follow |
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
<table class="board"> | |
<tr> | |
<td> | |
<div id="0" class="square" > | |
<input type="submit" name="square" value="0"> | |
</div> | |
</td> | |
<td> | |
<div id="1" class="square" > | |
<input type="submit" name="square" value="1"> |
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
<ul class="board clearfix"> | |
<% count = 0 %> | |
<% 9.times do %> | |
<li id="<%= count %>" class="square"> | |
<input type="submit" name="square" value="<%= count %>"> | |
</li> | |
<% count += 1 %> | |
<% end %> | |
</ul> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
it “returns first n numbers” do | |
# I know there are a few ways to approach this. I could chose a while loop and use a counter to track how many indexes I have counted through. However, I would go for a range. It gets the job done with less code. Less code is good. | |
end | |
it “returns a portion of a given group in the form of an array if some condition is met” do | |
# use find_all. | |
end | |
it “returns two arrays: one for a false condition” and it “returns two arrays: one for a true condition” do | |
# use partition. |
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 GameState | |
# omitted code | |
def winner | |
[first_row, | |
second_row, | |
third_row, | |
left_column, | |
middle_column, |
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 MutualMentions | |
attr_accessor :file, :relevant_tweets | |
def initialize(file) | |
@file = file | |
@relevant_tweets = [] # Red flag | |
end | |
def tweets_involving(user) | |
file = File.readlines(@file) |
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 MutualMentions | |
attr_accessor :file, :first_user, :second_user | |
def initialize(file, first_user, second_user) | |
@file = file | |
@first_user = first_user | |
@second_user = second_user | |
end | |
def tweets_involving(user) |
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 received(tweets) | |
tweets.each do |tweet| | |
if tweet.receiver == name | |
@received_tweets << tweet | |
end | |
end | |
@received_tweets | |
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
SampleApp::Application.routes.draw do | |
root 'static_pages#home' | |
match '/help', to: 'static_pages#help', via: 'get' | |
match '/about', to: 'static_pages#about', via: 'get' | |
match '/contact', to: 'static_pages#contact', via: 'get' | |
end | |
#should be | |
SampleApp::Application.routes.draw do |
OlderNewer