Skip to content

Instantly share code, notes, and snippets.

@pwentz
Forked from mbburch/prework.md
Last active May 4, 2016 15:56
Show Gist options
  • Save pwentz/5905842b855cc82291a86df5f0d8419d to your computer and use it in GitHub Desktop.
Save pwentz/5905842b855cc82291a86df5f0d8419d to your computer and use it in GitHub Desktop.
Pat Wentz Turing pre-work Gist

Turing School Prework - Patrick Wentz

Task A- Practice Typing:

  • screenshots of scores will be posted in comments

Task B- Algorithmic Thinking & Logic:

  • 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? No
  • How do you open Atom from your Terminal? Type "atom ." into your Terminal.
  • 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)? Command + P

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? -- Print working dictionary is helpful to remind the user where they are in their directory
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname? -- The hostname tells you the name of your computer.

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb? -- Start irb by typing irb in the command line. You will know you're in irb by the number version of ruby and the number line you're on. You can stop irb by typing exit. Ctrl + D also worked to exit irb on my Mac.
  • What might you use irb for? -- irb can be used to experiment or find out features for different languages. Not used for writing long programs.

Variables

  • How do you create a variable? -- On the left of the equal sign you put what you would like to name the variable, while on the right of the equal sign you write what you want the variable's value to be.
  • What did you learn about the rules for naming variables? -- A variable's value cannot be series of letters without quotations. A variable's value can not contain an underscore, a hyphen, or any combination of letters and numbers without surrounding in quotations.
  • How do you change the value of a variable? -- You can change the value of a variable the same way you declared the value of a variable.

Datatypes

  • How can you find out the class of a variable? -- Type .class after the variable name.
  • What are two string methods? -- Downcase, reverse.
  • How can you change an integer to a string? -- 8.to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
  • What is this used for in Ruby: #{}? -- That is called interpolation. You use it to apply a #{variable} to a string.
  • How would you remove all the vowels from a string? -- 'disenvowelment'.delete('aeiou')

Input & Output

  • What do 'print' and 'puts' do in Ruby? -- 'print' places the string on the same line as your next command - seemingly effective for prompts, while 'puts' places the text on a seperate line and your cursor starts on a fresh line.
  • What does 'gets' do in Ruby? -- Gets pauses the program and waits for a user to respond.
  • 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? -- An integer is a whole number while a float includes an exact number, including decimal point.
  • 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?
    • == Check to see if the number/string on the left is equal to the number/string on the right
    • = Check to see if the number/string on the left is greater than, or equal to the number/string on the right

    • <= Check to see if the number/string on the left is less than, or equal to the number/string on the right.
    • != Check to see if the number/string on the left is NOT equal to the number/string on the right.
    • && Check to see if both numbers/strings used are true.
    • || Check to see if either of the numbers/strings used are true.
  • What are two Ruby methods that return booleans? -- .empty, .include

Conditionals

  • What is flow control? -- Flow control is using conditions such as 'while' and 'if' to control what happens.
  • What will the following code return? -- Not many apples...
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? -- An infinite loop is when you write a loop and fail to write a condition for the loop to end, causing the loop to run until you intervene. Ctrl + C to get out of an infinite loop.
  • 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? -- Nil means nothing. It's a way of assigning a non-quant variable w/ a value of 0.
  • 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? -- Symbols allow you to reuse certain variables without declaring it each time. This allows your programs to be more efficient since you are using less memory.
  • Does naming symbols use the same rules for naming variables? -- No. Symbols are constants, so they cannot be assigned a new value like variables can.
  • 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? -- Array.length
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]? -- [0]
  • What do 'push' and 'pop' do? -- 'push' sends an element to the end of the array. 'pop' returns and removes an element at the end of the array.

Hashes

  • Describe some differences between arrays and hashes. -- Arrays are for storing data that can be called by it's number position in the array. Hashes are similar to arrays, but hashes assign keys w/ certain values - allowing the user to call the values with the keys assigned.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash? -- I would probably prefer an array when dealing with small amounts of data, or in cases where values need to come in a certain order. I would use Hashes on larger projects when storing large amounts of data, I probably wouldn't know what position everything would be in, so calling the value using a key would be ideal.
    • 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? -- I got through the condensed prework quite quickly, and should be finished the month-long version by the time I get to Turing - at which time my total hours spent on the prework should be around 80-100. Most of the concepts I picked up pretty quickly, so I was able to get through a lot of material in a short amount of time.
  • What are you most looking forward to learning more about? -- I'm looking forward to learning more about iterators and the different things you can do with them.
  • What topics would you most like to see reinforced by instructors? -- Symbols seemed like a very interesting and useful feature to me. The high level overview of classes in the Railsbridge curriculum raised more questions than answers.
  • What is most confusing to you about what you've learned? -- I struggled mightily with hashes in the Launch School exercises despite the fact that I didn't find arrays to be very challenging. Global and local variables made sense at first, but became much fuzzier when the concept of inner scope was introduced.
  • 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? -- -n
  • 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do? -- Ctrl-A takes you to the beginning of the line. Ctrl-E takes you to the end of the line. Ctrl-U deletes everything on the line to the left of your cursor.
  • 1.5: What are the shortcuts for clearing your screen, and exiting your terminal? -- Ctrl-L to clear your screen. Ctrl-D to exit terminal.
  • 2.1: What is the "cat" command used for? What is the "diff" command used for? -- cat displays the contents of a file. diff compares files line by line.
  • 2.2: What command would you use to list all txt files? What command would you use to show all hidden files? -- ls *.txt . ls -a
  • 3.1: How can you download a file from the internet, using the command line? -- By utilizing the cURL command.
  • 3.3: Describe two commands you can use in conjunction with "less". --
  • 3.4: What are two things you can do with "grep"?
@pwentz
Copy link
Author

pwentz commented May 3, 2016

LaunchSchool: Final Exercises

Exercises #1, #2, #3, #4, #5, #6, #9, #12, #13, #15...respectively

ex1
ex2
ex3
ex4
ex5
ex6
ex9
ex12
ex13
ex15

@pwentz
Copy link
Author

pwentz commented May 3, 2016

Task F: Write your own program

I did a coin flip program a few days ago but this is expands on that to help make those tough decisions.

decision_maker

@pwentz
Copy link
Author

pwentz commented May 3, 2016

Task F: Write your own program

Here is a little refactoring to make this program a bit more efficient.

dm_refactor1

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