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
//Git Commands | |
# NOTES: Lines starting with // or # are comments and should not be typed into terminal. Please be careful of your spelling, spacing, and case before initiating a command in terminal. | |
//Standards Commands to push to github (in order) | |
git add . | |
# adds all files and folders that contain files to be commited | |
git status | |
# shows what changes are going to be commited |
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
//Mercurial commands for Terminal | |
# NOTES: Lines starting with // or # are comments and should not be typed into terminal. | |
#For additional help use the wiki at http://mercurial.selenic.com/wiki/ | |
//Help for Commands | |
#<command> help: | |
$ hg help <command> | |
or | |
$ hg <command> - -help |
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
# Dog Years | |
# Calculate the age of Spike in dog years bases on his actual age | |
# | |
print "What age is Spike?: " | |
actualAge = gets.chomp().to_i | |
dogAge = actualAge * 7 | |
puts "Spike's actual age is #{actualAge} but his age in dog years is #{dogAge}." |
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
# Pie Slice exercise | |
# Calculate how many slices each person will receive | |
# | |
print "How many slices are there per pizza? " | |
slices = gets.chomp.to_i | |
print "How many people are eating? " | |
people = gets.chomp.to_i | |
print "How many pizzas pies are there? " |
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
# Shopping Bill exercise | |
# Calculate the average amount spent on groceries over 5 weeks | |
# | |
print "How much was spent on groceries for week 1? " | |
week1 = gets.chomp().to_f | |
print "Week 2? " | |
week2 = gets.chomp().to_f | |
print "Week 3? " |
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
# Discount exercise | |
# Calculate the discounted price for an item | |
# | |
print "What is the name of the item you would like to buy? " | |
itemDescription = gets.chomp() | |
print "What is the price of one #{itemDescription}? " | |
price = gets.chomp().to_f | |
print "At what percent is the discount offered? " |
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
# Exam | |
# Problem: Matt is a teacher grading the last exam taken for his course and he needs to log the progress of his students in his roll boo. | |
# There are 16 students in his class. If 10 of those students passed the exam, what percent failed the class | |
# Calculate the percent of failures in Matt's class. | |
# | |
print "Matt is a teacher grading the last exam taken for his course and he needs to log the progress of his students in his roll book. There are 16 students in his class. If any of these students fail the exam, they will fail the class. Only 10 of Matt's students passed the exam. Calculate the percentage of failures.\n\nEnter the total amount of students in Matt's class. " | |
studentTotal = gets.chomp().to_f # <= 16 students | |
print "Enter how many students passed Matt's class. " | |
studentsPassing = gets.chomp().to_f # <= 10 students |
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 'active_support/core_ext/enumerable.rb' # <= enables the use of array.sum with rails installed. (bit.ly/mCblb)· | |
# Marathon | |
print "Jon, Carla, Jim, and Harry won lottery tickets to run the NYC marathon. The runners now need to get sponsers so together they've g athered their running stats to see if they qualify for the money. The money people would like to know the average pace between the lotter y winners to get an idea of how fast their team is. Calculate the average time it takes for athlete runners to finish a marathon.\n\n" | |
distance = 26.2 # <= marathon distance in miles | |
runnersPace = [] | |
print "At what pace(minutes per mile) does Jon run a marathon? " |
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 'active_support/core_ext/enumerable.rb' # < array.sum with rails installed. (bit.ly/mCblb) | |
# Podcast | |
# | |
print "Terrance has a weekly podcast and he would like to know the total amount of listeners last weekend. Calculate the sum of downloads for the week.\n\n" | |
downloadsWeek = [] | |
print "How many downloads were there on Sunday?" | |
sunDL = gets.chomp().to_i |
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
# Temperature Converter | |
# | |
print "How many degrees is the temperature right now? " | |
degrees = gets.chomp().to_f | |
print "Fahrenheit(F) or Celsius(C)? " | |
unit = gets.chomp().to_s | |
OlderNewer