Skip to content

Instantly share code, notes, and snippets.

@saylerb
Forked from mbburch/prework.md
Last active March 21, 2016 05:29
Show Gist options
  • Save saylerb/e3005a8bba23ffedc7d3 to your computer and use it in GitHub Desktop.
Save saylerb/e3005a8bba23ffedc7d3 to your computer and use it in GitHub Desktop.
An example template for your Turing pre-work Gist

Turing School Prework

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?
    • I had previously installed Command Line Tools without installing Xcode. Do we need Xcode too, or can I continue without it? I verified that it's installed though with:

      $ xcode-select -p
      /Library/Developer/CommandLineTools
      
    • Figured out difference between .bashrc and .bash_profile

    • I already had some setting in a .bashrc, so I figured out I could source .bashrc from .bash_profile

    • Having trouble getting "seeing is believing" plugin to work correctly in Atom figured it out, I had an error inthe formatting for the Atom config file

  • How do you open Atom from your Terminal?
    • You can use the command atom and then the filename
  • What is the file extension for a Ruby file?
    • .rb
  • What is the Atom shortcut for hiding/ showing your file tree view?
    • cmd-\
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?
    • cmd-p or cmd-t

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 directory--useful for checking the full path of your current location in the file system
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
    • tells me the name of my computer. Output:

      $ hostname
      Brians-MacBook-Pro.local
      

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb?
    • type the command irb to start the interpreter, type exit to stop
  • What might you use irb for?
    • to prototype very simple scripts, or to check how the ruby language behaves in particular situations

Variables

  • How do you create a variable?
    • type a variable name, then an equal sign. Whatever you type to the right of the equal sign is the value assigned to the variable.
  • What did you learn about the rules for naming variables?
    • variable names allowed:
      • all letters (e.g. firstname)
      • can include an underscore (e.g. first_name)
      • can include a number in the middle or end (e.g. first1name or name1)
    • variable names NOT allowed:
      • all numbers (e.g. 101010)
      • include a dash (e.g. first-name)
      • first character a number (e.g. 1name)
    • SUMMARY: variables must be alphanumeric and if separators are used they must be underscores, and cannot start with a number. Variables also cannot start with an uppercase letter (Ruby treats that as a constant)
  • How do you change the value of a variable?
    • value of the variable persists until you re-assign the value (or exit the interpreter). For example:

2.3.0 :001 > first_name = "Brian" => "Brian" 2.3.0 :002 > first_name => "Brian" 2.3.0 :003 > first_name = "Toni" => "Toni" 2.3.0 :004 > first_name => "Toni"

**Datatypes**
* How can you find out the class of a variable?
- You want to call the `class` method on the variable.  Type variable name, then a period, then the method (`.class`)
* What are two string methods?
- two simple string methods are `chars` and `count`.  For example:

02.3.0 :001 > first_name = "Brian" => "Brian" 2.3.0 :002 > first_name.chars => ["B", "r", "i", "a", "n"] 2.3.0 :003 > first_name.chars.count => 5

* How can you change an integer to a string?
 - yes, you can use the `to_s` method. Just Calling the `to_s` method does not permanently assign string to variable though.

2.3.0 :001 > number = 5 => 5 2.3.0 :002 > number.to_s => "5" 2.3.0 :003 > number => 5 2.3.0 :004 > number = number.to_s => "5" 2.3.0 :005 > number => "5"


**Strings**
* Why might you use double quotes instead of single quotes in Ruby?
 - You need double if you have single quotes within your string. I was playing around in irb and it looks like you can escape qoutes too with a `\`. There are some interesting results with triple quotes...

2.3.0 :001 > variable = "This string has 'single quotes' in it" => "This string has 'single quotes' in it" 2.3.0 :002 > variable = "This string has "escaped double quotes" in it" => "This string has "escaped double quotes" in it" 2.3.0 :003 > variable = 'This string has "escaped double quotes" in it' => "This string has \"escaped double quotes\" in it" 2.3.0 :004 > variable = 'This string has 'escaped single quotes' in it' => "This string has 'escaped single quotes' in it" 2.3.0 :005 > variable = '''This string has "double quotes inside triple quotes" in it''' => "This string has "double quotes inside triple quotes" in it"

* What is this used for in Ruby: #{}?
- you can use that to "interpolate". Must use double quotes though. I also found out that Ruby won't interpolate with triple single quotes  `'''`, but will with triple double quotes `"""`!

2.3.0 :001 > variable = 'World!' => "World!" 2.3.0 :002 > "Hello #{variable}" => "Hello World!" 2.3.0 :003 > '''Hello #{variable}''' => "Hello #{variable}" 2.3.0 :004 > 'Hello #{variable}' => "Hello #{variable}" 2.3.0 :005 > """Hello #{variable}""" => "Hello World!"

* How would you remove all the vowels from a string?
- You can use the `delete` method and pass in a string containing the chars you want to remove:

2.3.0 :001 > my_string = "The quick brown fox jumped over the lazy dog" => "The quick brown fox jumped over the lazy dog" 2.3.0 :002 > my_string.delete('aeiou') => "Th qck brwn fx jmpd vr th lzy dg"

**Input & Output**
* What do 'print' and 'puts' do in Ruby?
- `print` will print a string to the screen without adding a new line
- `puts` will print a string to the user and add a new line
* What does 'gets' do in Ruby?
- `gets` will pause the program and prompt the user to enter a string, and press enter
* 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 number with no decimal place
- float is a number with a decimal place
* 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?
+ == *Tests for equal value*
+ >= *greater than or equal to*
+ <= *less than or equal to*
+ != *not equal to*
+ && *logical and*
+ || *logical or*
* What are two Ruby methods that return booleans?
- any method ending in an "?", e.g. `.end_with?` or `.include?`

**Conditionals**
* What is flow control?
- flow control is using logical statements to control how the program behaves under specific conditions
* What will the following code return? - This code will return the string `"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 a loop which will continue forever because there is no condition set to break out of the loop, or the program prevents the program from ever meeting the condition needed to break out of the 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 is a data type meaning "nothing."
* 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 can help Ruby use memory more efficiently
* Does naming symbols use the same rules for naming variables?
  - symbols seem to follow the same naming scheme as variales: cannot be a number, start with a number, or have a dash.
* 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?
  - you can call the `length` method
* What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
  - Pizza is the first item in the array at index `0`
* What do 'push' and 'pop' do?
  - `push` and `pop` will append an item to the array, and remove the last item from the array, respectively.

**Hashes**
* Describe some differences between arrays and hashes.
  - arrays are for ordered information, hashes are for unordered key-value pairs (pieces of data that must be linked together)
* 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 when order matters, for example, you are keeping track of the top 10 finishers of a bike race
  - You might prefer a hash when you are trying to store information to refer back to later. The order doesn't really matter, but you want a way of instantly accessing a specific piece of data.  To do this, you use 'keys' to instantly access the data (the values).
* * 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 was able to get through the required pre-work, which was mostly review for me, since I have some programming experience with Python
* What are you most looking forward to learning more about?
  - Looking forward to building rails apps, although I know that's ways away.
* What topics would you most like to see reinforced by instructors?
  - computer science fundamentals, and how to effectively work in a team
* What is most confusing to you about what you've learned?
  - still a little confused about symbols. I was under the impression that memory is so cheap these days that it is not necessary to manually manage memory. Especially when Ruby is a high level language (this isn't C), I was surprised to see that as something that is considered 'good form'
* What questions do you have for your student mentor or for your instructors?
 - no questions at this point, I'm excited to start class and I'm sure I will have many questions soon




## 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"?
@saylerb
Copy link
Author

saylerb commented Mar 6, 2016

Task E - Made an anki deck to help learn some bash commands

screenshot 2016-03-06 15 07 25

@saylerb
Copy link
Author

saylerb commented Mar 20, 2016

Task F Option 1 - Input and Output
io

@saylerb
Copy link
Author

saylerb commented Mar 20, 2016

Task F Option 1 - Numbers
screenshot 2016-03-20 16 28 29

@saylerb
Copy link
Author

saylerb commented Mar 21, 2016

Task F Option 1 - Conditionals
screenshot 2016-03-20 17 32 54
screenshot 2016-03-20 17 32 42

@saylerb
Copy link
Author

saylerb commented Mar 21, 2016

Task F Option 1 - Nil
screenshot 2016-03-20 22 24 36

@saylerb
Copy link
Author

saylerb commented Mar 21, 2016

Task F Option 1 - Symbols

screenshot 2016-03-20 22 55 51

@saylerb
Copy link
Author

saylerb commented Mar 21, 2016

Task F Option 1 - Hashes
screenshot 2016-03-20 23 23 31

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