Skip to content

Instantly share code, notes, and snippets.

@caward12
Forked from mbburch/prework.md
Last active January 23, 2017 03:12
Show Gist options
  • Save caward12/50dd49be891ab04663e7bb923888518e to your computer and use it in GitHub Desktop.
Save caward12/50dd49be891ab04663e7bb923888518e to your computer and use it in GitHub Desktop.
Turing pre-work Gist

Turing School Prework - Colleen

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:

https://gist.github.com/caward12/50dd49be891ab04663e7bb923888518e

Task D- Set up your Environment:

  • Did you run into any issues? - I needed a more up to date OSX to download xcode, so that took some time since I have a slow internet connection at the moment.
  • How do you open Atom from your Terminal? atom .
  • What is the file extension for a Ruby file? .rb
  • What is the Atom shortcut for hiding/ showing your file tree view? cmd b or cmd \
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)? cmd 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? present working directory - identifies the directory you are currently working out of.
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname? hostname shows the name of the computer - mine shows "Colleens-Air"

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb? Start by typing "irb" in the terminal. Stop by typing "exit". Control D also works on Mac.
  • What might you use irb for? irb is a good place to test/practice/experiment how ruby works and test different features.

Variables

  • How do you create a variable? name the variable on the left, use one "=" and then assign the value on the right
  • What did you learn about the rules for naming variables? you can not have a name of a variable that starts with a number, uses a dash or is a constant such as strings, true/false or numbers. Variable names can have numbers in the middle or at the end and can use underscores.
  • How do you change the value of a variable? By using a single "=" and changing the value on the right side of the equation. You can also use a function on the right side to determine/change value of the variable.

Datatypes

  • How can you find out the class of a variable? type .class after the variable
  • What are two string methods? :count, :upcase
  • How can you change an integer to a string? yes - by typing 5.to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby? interpolation only works when double quotes are used.
  • What is this used for in Ruby: #{}? interpolation - when you want to embed a code statement or function to the middle of a string
  • How would you remove all the vowels from a string? 'this is a string'.delete('aeiou')

Input & Output

  • What do 'print' and 'puts' do in Ruby? They both print information to the user 'print' does not make a new line after printing while 'puts' does
  • What does 'gets' do in Ruby? pauses the program to get user input
  • 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? integers are whole numbers and floats are real numbers that have decimals.
  • 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?
    • == compares things to see if they are equal
    • = greater than or equal to

    • <= less than or equal to
    • != not equal
    • && and
    • || or
  • What are two Ruby methods that return booleans? 'sandwich'.end_with?('h') [1,2,3].include?(9)

Conditionals

  • What is flow control? It is how a program steps through each statement/instruction. By adding conditionals, the program can make "decisions" and flow to a different set of instructions based on input from the user.
  • 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? When a loop does not have any step to make it false, then the loop will run forever. You can use ctrl+c to quit the program
  • 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 or that a variable has not been assigned a value or a function does not return a value.
  • 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 help reduce the amount of memory ruby uses by allowing one constant value to be used instead of creating multiple variables
  • Does naming symbols use the same rules for naming variables? not quite - naming symbols can not have dashes, cannot start with a number, can not be a number but you can have a symbol that is :true or :false
  • 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? .length
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]? 0
  • What do 'push' and 'pop' do? 'push' adds an element to the end of an array and 'pop' removes or "pops off" the last item in the array and returns it.

Hashes

  • Describe some differences between arrays and hashes. Arrays are a list of items and you access them by their order in the list. Hashes are a list of pairs of items - key and values. You can access hashes via their key.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash? You would use an array when you need an ordered list of items - a grocery list or list of names of students. A hash is best when you want to store related data - say mabye names of students and their grades.
    • 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? To call a function, type the name of the function and then include the values it needs to do the work. to store the result you can name a variable and then call the funtion on the right hand side
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables. initialize method: saves the initial data object is created with new method: creates a new instance of your object instance variables: when a new instance of your object is created, the initalize method runs with the instance variable given when the object was created (with the new method)
  • 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"?
@caward12
Copy link
Author

screen shot 2017-01-22 at 3 30 28 pm

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