Skip to content

Instantly share code, notes, and snippets.

@AELSchauer
Forked from mbburch/prework.md
Last active November 28, 2016 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AELSchauer/762105783dc80ce2f9eb80b06bd4406f to your computer and use it in GitHub Desktop.
Save AELSchauer/762105783dc80ce2f9eb80b06bd4406f to your computer and use it in GitHub Desktop.
Ashley Schauer Pre-Work

Turing School Prework -- Ashley Schauer

Task A -- Practice Typing

  • See screenshot in comments Done

Task B -- Algorithmic Thinking & Logic

  • See screenshots in comments
  • Concept Quizzes Done
  • Level 1 Done
  • Level 2 Done
  • Level 3
  • Level 4
  • Level 5

Task C -- Create your Gist

Task D -- Set up your Environment

  • Did you run into any issues? Yeah, trying to set up my environment to open Sublime from the terminal. I accidently messed up my .bash_profile so no commands (e.g. $, open, source) were working. I searched around Google, found a way to reset it and tried again. It worked fine the second time.
  • How do you open Sublime from your Terminal? "submlime" + "folder" or + "new filename" or "." to open everything.
  • What is the file extension for a Ruby file? .rb.
  • What is the Sublime shortcut for hiding/showing your file tree view? Cmd+K / Cmd+B
  • What is the Sublime shortcut for quickly finding a file (fuzzy finder)? ???

Task E -- The Command Line

  • I completed the first section of the Codecademy Command Line Lesson. I have no idea what the flashcards are supposed to be.

Day One Questions:

  • What does pwd stand for, and how is this command helpful? It prints the current directory from the root directory.
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname? Ashleys-MacBook-Pro.local

Task F -- Learn Ruby

Option 1 Questions

IRB

  • How do you start and stop irb? Type irb into the terminal. Ctrl+Z to quit irb.
  • What might you use irb for? It's the shell for ruby. Rather than writing code in a text editor and then calling the file from the terminal, you can write code directly into the terminal.

Variables

  • How do you create a variable? [variable name] = [object]
  • What did you learn about the rules for naming variables?
    • You can't declare a variable name that is considered a constant. However, the constant can be used within a longer variable name.
      • Example: "class" is already used by Ruby to declare a class. However, "class" can be used within "className" or "class_name".
      • Example: Numbers are considered constants. "2000" cannot be used as a variable name, but spaceodyssey2000 can.
    • When declaring a variable, don't include quotes "" because that turns it into a string and strings are constants.
    • Variable names can include an underscore "_", but not a dash "-".
    • Variable names may include a number, but cannot start with a number.
    • It isn't necessary to declare the object class (e.g. string, integral, float, array). However, you must format the data in a specific way. For example, 10 = integer, 10.0 = float.
  • How do you change the value of a variable? Declare the variable again the same way you created it.

Datatypes

  • How can you find out the class of a variable? [Variable name].class
  • What are two string methods? [String].capitalize will turn the first character of the string to the uppercase of that letter and then return the string. [String].length will count the number of characters in the string and then return the count.
  • How can you change an integer to a string? [Integer].to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby? Writing more commonly uses contractions than double quotes, which means you'd have to use escape characters more often.
  • What is this used for in Ruby: #{}? Interpolation is a faster way to include a variable or operation within a string than concatenation.
    • Concatenation: "My name is " + first_name + " and I am " + (2016-1988).to_s + " years old."
    • Interpolation: "My name is #{first_name} and I am #{2016-1988} years old."
  • How would you remove all the vowels from a string? [String].delete("aeiouyAEIOUY")

Input & Output

  • What do 'print' and 'puts' do in Ruby? They both display the value of an argument. However, 'puts' displays this information on a new line while 'prints' displays this information in the same line as any previous displayed information.
  • What does 'gets' do in Ruby? Gets prompts the user to enter an input.
  • Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O". Done

Numbers & Arithmetic

  • What is the difference between integers and floats? Integers are always whole numbers. Floats include decimals places.
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers". Done

Booleans

  • What do each of the following symbols mean?
    • == equal to
    • = greater than or equal to

    • <= less than or equal to
    • != does not equal
    • && and
    • || or
  • What are two Ruby methods that return booleans? object1 == object2 and object.is_a?(ClassName)

Conditionals

  • What is flow control? *All programming languages include a set of instructions that will alter what the code does. Some examples include managing conditions (e.g. if...elseif...else statements), exception handling (e.g. try...catch), and loops (e.g. for and while).
  • What will the following code return?
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end
  • That code will return "Not many apples..."
  • What is an infinite loop, and how can you get out of one? An infinite loop is when you create a loop, but don't include a exit condition or the exit condition is never met. For example, you repeatedly subtract a number by two and end when it equals 0, but the initial number was odd so it'll never equal 0.
  • Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals". Done

nil

  • What is nil? Nil, basially, means that no data exists for that variable. That isn't the same as empty. If you had an empty page or empty book (similar, metaphorically to "" or []), you still have the page and the book. With "nil" you have nothing at all. If you ask for the index of something, for example, and you receive "nil", that means the indexed item doesn't exist.
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil". Done

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". Done

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 adds an entry to the end of an array. Pop removes the last entry from an an array.

Hashes

  • Describe some differences between arrays and hashes. Both arrays and hashes are sets of data where the value matched to a unique key. In the case of arrays, the dataset is linear like a list. The key is equal to its order in the array. The keys in arrays can never be changed once they exist (e.g. 1 will always be 1), but the order of the values (and therefore the key/value pairs) do. With a hash, the set of data is non-linear. There is no "order" and so key can be customized and changed. So let's say you had twenty shapes in front of you and one of them is a yellow triangle. Let's say I want to find the yellow triangle. With an array, it's kind of like putting each shape inside separate, identical, unmarked boxes. The fastest way to find the shape is open and close each box, one after another, until I found the yellow triangle. If my friend needs to know where to find the yellow triangle, I would say it's in the third box. If someone rearranged the order of the boxes, I would have to repeat the same process to find the yellow triangle again. With a hash, the shapes aren't in boxes and instead they're just sitting out in the open. The key to finding the yellow triangle isn't the order of the shapes, but in the fact that it is yellow and a triangle. If someone were to rearrange all the items, it wouldn't matter. (The problem with my analogy is that computers open those metaphorical boxes very quickly. So when data sets are small, it's usually easier to use arrays because the process of assigning keys is automatic and easy.)
  • What is a case when you might prefer an array? What is a case when you might prefer a hash? It's better to use an array when order matters, or if you have duplicates in your data. A hash is better when you want to customize the key, order doesn't matter, and your data sets are massive.
    • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes". Done

Task G -- Prework Reflection:

  • Were you able to get through the work? Did you rush to finish, or take your time?
    • I've worked with all this information before (except symbols) so it didn't take long.
  • What are you most looking forward to learning more about?
    • How to build all this into an actual application, and proper commenting and collaboration habits.
  • What topics would you most like to see reinforced by instructors?
    • When to use hashes vs. arrays.
  • What is most confusing to you about what you've learned?
    • Symbols. I've never used them before. I think I understand them, but some best practices would be helpful.
  • What questions do you have for your student mentor or for your instructors?
    • Nothing at this time.

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. Done.
  • What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs. Done
  • Functions: How do you call a function and store the result in a variable? Define a function then declare the variable as the function name.
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
  • Initialize method is where you define the inital data you need for the class and perform any additional set up, like defining a variable as a string or integer.
  • New method is where you define the actions associated with your new class. For example, if the class is TV, methods might include 'changing the channel' or 'shut off'.
  • Instance variables are like normal variables, but are only visible from within the class.
@AELSchauer
Copy link
Author

AELSchauer commented Nov 1, 2016

@AELSchauer
Copy link
Author

AELSchauer commented Nov 1, 2016

@AELSchauer
Copy link
Author

AELSchauer commented Nov 1, 2016

@AELSchauer
Copy link
Author

AELSchauer commented Nov 15, 2016

@AELSchauer
Copy link
Author

AELSchauer commented Nov 22, 2016

@AELSchauer
Copy link
Author

AELSchauer commented Nov 26, 2016

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