Skip to content

Instantly share code, notes, and snippets.

@calaway
Forked from mbburch/prework.md
Last active June 27, 2016 04:46
Show Gist options
  • Save calaway/2e576df7d3af07eab175f0f112f892c9 to your computer and use it in GitHub Desktop.
Save calaway/2e576df7d3af07eab175f0f112f892c9 to your computer and use it in GitHub Desktop.
Calaway's Turing pre-work Gist

Turing School Prework - Calaway

https://github.com/turingschool/prework/blob/master/prework-month.md

Task A- Practice Typing:

https://typing.io

  • screenshots of scores will be posted in comments

Task B- Algorithmic Thinking & Logic:

https://brilliant.org/computer-science/computer-science/?subtopic=types-and-data-structures

  • screenshots of completed sections will be posted in comments

Task C- Create your Gist:

Task D- Set up your Environment:

  • Did you run into any issues?
  • How do you open Atom from your Terminal?
  • What is the file extension for a Ruby file?
  • What is the Atom shortcut for hiding/ showing your file tree view?
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?

Task E- The Command Line:

  • screenshots of your terminal after each exercise will be posted in comments

Day One Questions:

  • What does pwd stand for, and how is this command helpful?
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb?
  • What might you use irb for?

Variables

  • How do you create a variable?
  • What did you learn about the rules for naming variables?
  • How do you change the value of a variable?

Datatypes

  • How can you find out the class of a variable?
  • What are two string methods?
  • How can you change an integer to a string?

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
  • What is this used for in Ruby: #{}?
  • How would you remove all the vowels from a string?

Input & Output

  • What do 'print' and 'puts' do in Ruby?
  • What does 'gets' do in Ruby?
  • Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".

Numbers & Arithmetic

  • What is the difference between integers and floats?
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".

Booleans

  • What do each of the following symbols mean?
    • ==
    • =

    • <=
    • !=
    • &&
    • ||
  • What are two Ruby methods that return booleans?

Conditionals

  • What is flow control?
  • What will the following code return?
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end
  • What is an infinite loop, and how can you get out of one?
  • Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".

nil

  • What is nil?
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".

Symbols

  • How can symbols be beneficial in Ruby?
  • Does naming symbols use the same rules for naming variables?
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".

Arrays

  • What method can you call to find out how many elements are in an array?
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
  • What do 'push' and 'pop' do?

Hashes

  • Describe some differences between arrays and hashes.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
    • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".

Task G- Prework Reflection:

  • Were you able to get through the work? Did you rush to finish, or take your time?
  • What are you most looking forward to learning more about?
  • What topics would you most like to see reinforced by instructors?
  • What is most confusing to you about what you've learned?
  • What questions do you have for your student mentor or for your instructors?

Pre-work Tasks- One Month Schedule

(Note: You will most likely only get to the following sections if you have more than a week for your pre-work. If you are doing the one week pre-work schedule, you may delete this section of the Gist.)

Railsbridge Curriculum, cont.

  • Loops: Take a screenshot of your "Challenge" program, and post it as a comment in your Gist.
  • What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
  • Functions: How do you call a function and store the result in a variable?
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
  • How to Write a Program: Screenhero with your student mentor and share your program. Write a bit about what you found most challenging, and most enjoyable, in creating your program.

Launch School Ruby Book

  • screenshots will be posted in comments
  • What are your three biggest takeaways from working through this book?

CodeSchool

  • screenshots will be posted in comments
  • What are your two biggest takeaways from working through this tutorial?
  • What is one question you have about Git & GitHub?

Workflow Video

  • Describe your thinking on effective workflow. What shortcuts do you think you'll find most useful? What would you like to learn or practice that will most help you improve your speed and workflow?

Michael Hartl's Command Line Book

As you complete each section, respond to the related questions below (mostly taken directly from the tutorial exercises):

  • 1.3: By reading the "man" page for echo, determine the command needed to print out “hello” without the trailing newline. How did you do it?
  • 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
  • 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
  • 2.1: What is the "cat" command used for? What is the "diff" command used for?
  • 2.2: What command would you use to list all txt files? What command would you use to show all hidden files?
  • 3.1: How can you download a file from the internet, using the command line?
  • 3.3: Describe two commands you can use in conjunction with "less".
  • 3.4: What are two things you can do with "grep"?
@calaway
Copy link
Author

calaway commented May 24, 2016

@calaway
Copy link
Author

calaway commented May 26, 2016

https://typing.io/lesson/ruby/rails/relation.rb/5
I had already done 1 through 4, so it put me at 5.

screen shot 2016-05-25 at 9 56 19 pm

@calaway
Copy link
Author

calaway commented May 29, 2016

Task D- Set up your Environment:

Did you run into any issues?
I ran into just one issue. I'm not sure how important it is.
Under the section heading RVM > Loading / Post-Install it says:

Look for the line in the output from the RVM installation that starts with To start using RVM you need to run 'source ... Copy the command inside of the backticks (don't include the backticks), paste it into your terminal window, and hit enter.
I closed the terminal window after the previous command, but before I read this, so I couldn't see that line. I tried running the previous command again, but it didn't have that text. So I didn't complete this instruction.

How do you open Atom from your Terminal?
atom [options] [path ...]

What is the file extension for a Ruby file?
.rb

What is the Atom shortcut for hiding/ showing your file tree view?
command + \

What is the Atom shortcut for quickly finding a file (fuzzy finder)?
Find file: command + P

@calaway
Copy link
Author

calaway commented May 29, 2016

Task D
Type the following commands into your Terminal to ensure you have Ruby, RVM, and Git installed. Take a screenshot that shows the versions of each of these, and post it as a comment in your Gist:
which ruby
git --version
rvm --version

screen shot 2016-05-29 at 5 04 43 pm

@calaway
Copy link
Author

calaway commented May 30, 2016

Task E:
What does pwd stand for, and how is this command helpful?
Print working directory. It outputs the name of the folder/directory you're currently in.

What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
It outputs the name of your computer.
Calaways-MacBook-Pro.local

@calaway
Copy link
Author

calaway commented May 30, 2016

@calaway
Copy link
Author

calaway commented May 30, 2016

Task E:
Made it through 'ls'
I'm already very familiar with most of these commands since I've been using Linux as my primary home OS for ten years, so I'm kind of speeding through them.
screen shot 2016-05-30 at 3 45 33 pm
screen shot 2016-05-30 at 3 51 33 pm
screen shot 2016-05-30 at 3 56 37 pm

@calaway
Copy link
Author

calaway commented Jun 2, 2016

Okay, I figured out what was going on with my prior issue from this post above: https://gist.github.com/calaway/2e576df7d3af07eab175f0f112f892c9#gistcomment-1789554

As part of the rvm installation it adds the following to the user's .bashrc file: source ~/.rvm/scripts/rvm. This is so every time the terminal is launched it reads and executes the scripts in the file ~/.rvm/scripts/rvm which prepare rvm to be run. In our instructions it could have instructed us to open a new terminal so the command source ~/.rvm/scripts/rvm would have been run automatically, but instead it instructed us to run that command manually so we didn't need to open a new terminal window.

In short, it was irrelevant that I missed that instruction. It had me scared for a bit though, haha.

@calaway
Copy link
Author

calaway commented Jun 3, 2016

Task F- Learn Ruby:
Option 1 Questions:
IRB
How do you start and stop irb?
Start: $ irb
Stop: > exit

What might you use irb for?
Testing short bits of code. Running simple commands, like math functions.

Variables
How do you create a variable?
Put the name of the variable on the left of the equal sign and the value to assign to it on the right.

What did you learn about the rules for naming variables?
It seems variables can be a combination of letters, numbers, and underscores, but cannot begin with a number.

How do you change the value of a variable?
The exact same way you assigned a value to it originally. It overwrites the original value.

Datatypes
How can you find out the class of a variable?
Submit variable1.class to return the class of variable1

What are two string methods?
:reverse and :downcase!

How can you change an integer to a string?
5.to_s

@calaway
Copy link
Author

calaway commented Jun 17, 2016

Task F- Learn Ruby:

Strings
Why might you use double quotes instead of single quotes in Ruby?
Double quotes allow string interpolation, whereas single quotes don't

What is this used for in Ruby: #{}?
String interpolation. Use it to have any valid ruby statement evaluated and inserted into the string.

How would you remove all the vowels from a string?
use the method .delete("aeiou")

Input & Output
What do 'print' and 'puts' do in Ruby?
They print information to the user's screen

What does 'gets' do in Ruby?
pauses your program and waits for the user to type something and hit the enter key. It then returns the value back to your program and continues execution.

Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".
screen shot 2016-06-16 at 9 55 45 pm

Numbers & Arithmetic
What is the difference between integers and floats?
An integer is a positive or negative whole number. A float is any real number, represented with a decimal.

Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
screen shot 2016-06-16 at 10 30 17 pm

Booleans

  • What do each of the following symbols mean?
  • ==: are the two equal?
  • =: is the first greater than or equal to the second?

  • <=: is the first less than or equal to the second?
  • !=: are the two not equal?
  • &&: are both true?
  • ||: is either true?
  • What are two Ruby methods that return booleans?
    .odd? & .empty?

Conditionals
What is flow control?

What will the following code return?

apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end

Not many apples...

What is an infinite loop, and how can you get out of one?
A while loop whose condition never evaluates to false and will run indefinitely. Exit with ctrl+c

Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
<continued ...>

@calaway
Copy link
Author

calaway commented Jun 23, 2016

@calaway
Copy link
Author

calaway commented Jun 24, 2016

**Task F- Learn Ruby:

Conditionals** (continued)
Take a screenshot of your program and terminal showing two different outputs, and post it in the comments.
screen shot 2016-06-24 at 1 54 05 pm
screen shot 2016-06-24 at 1 54 34 pm

nil
What is nil?
nil is the absence of an assigned value.

Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
screen shot 2016-06-24 at 2 19 07 pm

Symbols
How can symbols be beneficial in Ruby?
It saves memory by pointing to the same object rather than creating duplicate instances.

Does naming symbols use the same rules for naming variables?
Yes.

Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".

screen shot 2016-06-24 at 4 21 03 pm

screen shot 2016-06-24 at 4 21 38 pm

@calaway
Copy link
Author

calaway commented Jun 27, 2016

Arrays
What method can you call to find out how many elements are in an array?
:length

What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
Zero

What do 'push' and 'pop' do?
push : add a new element to the end of the array
pop: remove (and return) the element at the end of the array
screen shot 2016-06-26 at 10 25 26 pm

Hashes
Describe some differences between arrays and hashes.
Elements of an array are called by their index, while elements of a hash are called by their key.

What is a case when you might prefer an array? What is a case when you might prefer a hash?
You might prefer an array on an ordered list, such as US Presidents. You might prefer a hash on a list of things and a specified characteristic, such as having US Presidents as the key and and their political party as the value.

Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
screen shot 2016-06-26 at 10 37 55 pm

@calaway
Copy link
Author

calaway commented Jun 27, 2016

Task G- Prework Reflection:

Were you able to get through the work? Did you rush to finish, or take your time?
Yes, I did make it through all of tasks A through G. I was able to take my time.

What are you most looking forward to learning more about?
I'm excited to dive into Ruby!

What topics would you most like to see reinforced by instructors?
From the prework I could use some more reinforcement on pushd/popd in CLI and symbols in Ruby.

What is most confusing to you about what you've learned?
Same answer as the previous question.

What questions do you have for your student mentor or for your instructors?

  • Why is there a need for both puts and print? What are examples of when each would be useful over the other?
  • Single and double quotes are mostly interchangeable. Is one considered better form than the other in general?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment