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
def getNumbers(workingArray) | |
# Method to take multiple integers as input from user. | |
puts "Please enter the numbers you'd like me to use. Type 'done' when you're finished." | |
nextnum = 0 | |
# Creates nextnum as variable. | |
while nextnum != "done" | |
nextnum = gets.chomp! | |
if nextnum == "done" | |
puts "Calculating!" | |
elsif nextnum != "0" && nextnum.to_i == 0 |
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
def ask(question) | |
# Defines method for asking questions and receiving input. | |
puts question | |
gets.chomp! | |
end | |
def get_name | |
puts "What is your full name?" | |
full_name = gets.chomp! | |
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
module LastN | |
def last(n) | |
self[-n,n] | |
end | |
end | |
# Defines a module that calls certain range on object. | |
class String | |
include LastN | |
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
students = [ # Array of students' names. | |
"Alex Hint", | |
"Amy Ruan", | |
"Ana Giraldo-Wingler", | |
"Cooper Mayne", | |
"Diego Palma", | |
"Edward Shin", | |
"Enoch Riese", | |
"Harrison Powers ", | |
"Jaclyn Jimenez", |
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
class Apartment | |
attr_accessor :price, :sqft, :num_beds, :num_baths, :renters, :apartment_number, :building | |
def initialize(apartment_number, sqft, num_beds, num_baths) | |
@apartment_number = apartment_number | |
@sqft = sqft | |
@num_beds = num_beds | |
@num_baths = num_baths | |
@price = (50 * sqft) + (1000 * num_baths) + (2000 * num_beds) | |
@tenants = {} | |
@building = "" |
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
def game(input1, input2) | |
if input1 == input2 | |
outcome = "It's a tie!" | |
elsif input1 == "rock" | |
if input2 == "paper" | |
outcome = "Paper covers rock. Player 1 loses!" | |
elsif input2 == "scissors" | |
outcome = "Rock smashes scissors. Player 1 wins!" | |
end | |
elsif input1 == "paper" |
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
before do | |
ActiveRecord::Base.logger = Logger.new( STDOUT ) | |
ActiveRecord::Base.establish_connection( | |
:adapter => "postgresql", | |
:host => "localhost", | |
:username => "Ducky", | |
:password => "", | |
:database => "instagram_db" | |
) |
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
#Gemfile | |
group :development, :test do | |
gem 'pry-rails' # Causes rails console to open pry | |
# https://github.com/rweng/pry-rails | |
gem 'pry-debugger' # Adds step, next, finish, and continue commands and breakpoints | |
# https://github.com/nixme/pry-debugger | |
gem 'pry-stack_explorer' # Navigate the call-stack | |
# https://github.com/pry/pry-stack_explorer | |
gem 'annotate' # Annotate all your models, tests, fixtures, and factories | |
# https://github.com/ctran/annotate_models |
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
development: | |
adapter: postgresql | |
encoding: unicode | |
database: <%= File.basename(Rails.root) %>_development | |
pool: 5 | |
host: localhost | |
username: <%= ENV['PG_USERNAME'] %> | |
password: | |
test: |
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
# README | |
# pass in this file when creating a rails project | |
# | |
# for example: | |
# rails _3.2.14_ new awesome_app -d postgresql -m ~/kickhash_template.rb | |
remove_file "README.rdoc" | |
create_file "README.md", "TODO" | |
gem 'rspec-rails', group: [:test, :development] |
OlderNewer