Skip to content

Instantly share code, notes, and snippets.

@dtinianow
Forked from mbburch/prework.md
Last active May 9, 2016 02:20
Show Gist options
  • Save dtinianow/183b8aa110bf920ff7a3459ec9bbbe99 to your computer and use it in GitHub Desktop.
Save dtinianow/183b8aa110bf920ff7a3459ec9bbbe99 to your computer and use it in GitHub Desktop.
David's Turing pre-work Gist

Turing School Prework - David Tinianow

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? Could not get seeing-is-believing to work initially, but it worked after restarting Atom
  • 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? command + \
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)? command + t OR 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 directory

  • pwd prints the name of the directory/folder you are currently in and is helpful because it tells you where you are

  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?

  • hostname tells you the name of your computer/network

  • My terminal shows petrichord-turing-prework-3018899

Task F- Learn Ruby:

Option 1 Questions:

######Apr 23: Ruby, What is Ruby, Command Line, irb, Running Programs from a File, Variables ######Apr 24: Datatypes, Strings, Input & Output, Numbers & Arithmetic, Booleans ######Apr 26: Conditionals, nil ######Apr 27: Symbols, Working with Collections, Arrays, Hashes, Loops, Summary: Basics, Functions, Classes ######Apr 28: How to Write a Program

IRB

  • How do you start and stop irb?
  • To start, type irb
  • To stop, type exit
  • What might you use irb for?
  • The Interactive Ruby Interpreter, or irb, is a good place to try out different features of Ruby

Variables

  • How do you create a variable?
    • You create a variable by assigning a name to a value using the equals sign
  • What did you learn about the rules for naming variables?
    • Allowed: all letters, underscores, numbers in the middle and end
    • Not Allowed: all numbers, dashes, numbers at the start, strings
  • How do you change the value of a variable?
    • Re-assign the variable to a new value

Datatypes

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

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
  • Double quotes allow you to embed a Ruby statement in another string, which is known as string interpolation
  • What is this used for in Ruby: #{}?
  • String interpolation: the Ruby statement you want to embed in another string will be put inside the curly braces
  • How would you remove all the vowels from a string?
  • 'I am a string'.delete('AEIOUaeiou')

Input & Output

  • What do 'print' and 'puts' do in Ruby?
  • puts prints information for the user and returns a value of nil
  • print is the same as puts, but doesn't make a new line after printing
  • What does 'gets' do in Ruby?
  • gets pauses the program, takes input from the user, and returns that input value back to the program
  • 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
  • Floats are 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?
    • == is equal to
    • = is greater than or equal to

    • <= is less than or equal to
    • != is not equal to
    • && and
    • || or
  • What are two Ruby methods that return booleans?
  • Methods in Ruby that return booleans end with a question mark
  • .end_with?()
  • .include?()

Conditionals

  • What is flow control?
  • Flow control is a way of having a program make decisions for you.
  • Code is selectively executed based on values that exist in a program
  • 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 occurs when a program loops endlessly because there is no terminating condition
  • Escape an infinite loop 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".

nil

  • What is nil?
  • A special Ruby data type that means 'nothing'
  • Nil is used to show that variable has not been assigned to anything or that a function did 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 let Ruby variables point to the same object in several places
  • This is beneficial because it allows Ruby to use memory more efficiently
  • Does naming symbols use the same rules for naming variables?
  • Yes, except a symbol can also be written as if it were a string in quotes
  • 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 a new element to the end of the array
  • pop removes and returns the element at the end of the array

Hashes

  • Describe some differences between arrays and hashes.
  • Arrays use brackets, while hashes use curly braces
  • Arrays store a list of items, while hashes store pairs of items by using a key to associate with a value
  • Arrays values are accessed by index or position, while hash values are accessed using a key
  • Hashes use a hashrocket (=>) to associate a key with a value, while arrays do not use this
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
  • An array would be preferable when you want to store an ordered list of items and access them by position
  • A hash would be preferable when you want to access items based on a name or key
    • 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 finished the full month of pre-work in the two weeks before the program started. I took my time as I worked through the week-long schedule of pre-work. The rest of the pre-work felt a bit rushed, since I squeezed the remaining five priorities into one week. I was felt particularily rushed to complete the command line book and Git exercise.
  • What are you most looking forward to learning more about?
  • I am most looking forward to building programs using Ruby, especially learning to handle lots of data.
  • What topics would you most like to see reinforced by instructors?
  • I felt the tutorial on Git did not give me a good grasp of it's practical use, so I would like to get more hands-on experience using this. I would also like to learn more about the particular quirks and tools of Ruby that make it unique from other programming languages.
  • What is most confusing to you about what you've learned?
  • The chapter in Launch School about manipulating files with Ruby was confusing to me. Much of what was happening was unclear.
  • I also need more experience using Git to understand it's practicality
  • What questions do you have for your student mentor or for your instructors?]
  • What is the exact function of p? (as opposed to puts)
  • Can I get my shell to show a return value or print it out? (i.e. irb shows a return value indicated by a hashrocket)
  • Does using the git rm command remove the file from the computer entirely? Or just within the git repository?

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.
  • All of them - see screenshots
  • Functions: How do you call a function and store the result in a variable?
  • Set a variable equal to the function as it is being called
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
  • initialize method saves the initial data your object is created with and performs any other required set-up
  • new method creates an instance of your object. Arguments passed in to new are to sent to your initialize method
  • instance variables start with an @ and are variables only visible from inside a specific instance of your object
  • 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.
  • It was cool to create a program that had multiple components to it, and to see how it could continuously be broken down into simpler pieces. The most challenging part was trying to read through the code initially to understand what each part of the code did. The most enjoyable part came from the most challenging, which was understanding how the code works. It was nice to make the code progressively cleaner and easier to read.

Launch School Ruby Book

  • screenshots will be posted in comments
  • What are your three biggest takeaways from working through this book?
  • The main thing I noticed is how different Ruby syntax is from Javascript. It's going to take some adjusting to get used to writing Ruby. Ruby seems to be much cleaner, and it seems to be more reliant on pre-existing methods. Going through this book made it seem like much of learning Ruby will be looking up methods and figuring out how to implement them.
  • The biggest challenge for me in this book was the section on Files. Many of the commands and processes happening during the file conversion exercises were not fully explained.
  • Using hashes to form associative arrays was also a new topic for me. I can see how important this tool will be when it comes to organizing and storing data. Exercise 14, in the end of the book, asks you to add array data into a hash. This was challenging to figure out which methods can be used with different object types and how implement them. Additionally, I was adjusting to the new syntax of using .each loops instead of for loops.

CodeSchool

  • screenshots will be posted in comments
  • What are your two biggest takeaways from working through this tutorial?
  • Git will be an important tool for working on programs and putting different pieces together. It was a bit confusing to see the practicality of git using this tutorial, because it just had you repeat commands, rather than create files and work through it yourself. If the purpose was simply to gain some visual familiarity with git, I would say it was successful.
  • What is one question you have about Git & GitHub?
  • Why would you ever edit files using the terminal and git rather than a text editor? It seems like it would be way more visually challenging to try to edit a file in the terminal than in a text editor.
  • Does using the 'git rm' command remove the file from the computer entirely? Or just within the git repository?

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?
  • I think the ability to highlight all instances of a word, and modify all of them simulateously using multiple cursors will be extremely useful. This could save a lot of time debugging, for instance, when you forget to change a particular instace of a word or variable. If there are any exercises to practice using these commands to help make them muscle memory, that would be helpful. Besides that, I will try to just use them as much as possible.

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?
  • The command needed is '\c', following the string you want to print out. However, this did not work initially. I also needed to include '-e' to enable interpretation of backslashes. This worked: echo -e "hello world\c"
  • 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
  • Ctrl-A: move to beginning of the command line
  • Ctrl-E: move to end of the command line
  • Ctrl-U: delete to beginning of command line
  • 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
  • Ctrl-L or clear: clears terminal
  • Ctrl-D or exit: exits terminal
  • 2.1: What is the "cat" command used for? What is the "diff" command used for?
  • cat: prints the contents of a whole file
  • diff: prints the differences between two files
  • 2.2: What command would you use to list all txt files? What command would you use to show all hidden files?
  • ls *.txt: list all txt files
  • ls -a: list all files including hidden
  • 3.1: How can you download a file from the internet, using the command line?
  • curl: interact with URLs
  • 3.3: Describe two commands you can use in conjunction with "less".
  • /: search for a string
  • n: move to the next search result
  • N: move to the previous search result
  • 3.4: What are two things you can do with "grep"?
  • grep can be used to search for a substring in a file
  • grep -i is a way to search for a case-insensitive substring in a file
  • the outcome of grep can be piped to wc to find the number of instances of a substring in a file
@dtinianow
Copy link
Author

Task A - Typing on Apr 28
image

@dtinianow
Copy link
Author

dtinianow commented May 1, 2016

Task D - Setting up Environment on Apr 30
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: The Basics on Apr 30
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Variables on May 1
image

@dtinianow
Copy link
Author

dtinianow commented May 1, 2016

Task A - Typing on Apr 30
image

@dtinianow
Copy link
Author

Task B - Logical Reasoning Level 1 on Apr 30
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Methods on May 2
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Flow Control on May 2
image

@dtinianow
Copy link
Author

Task A - Typing on May 2
image

@dtinianow
Copy link
Author

Task B - Logic Challenges Level 2 on May 2
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Iterators on May 3
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Arrays on May 3
image

@dtinianow
Copy link
Author

Task A - Typing on May 4
image

@dtinianow
Copy link
Author

Task B - Logic Puzzles Intermediate on May 3
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Hashes on May 4
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Files on May 5
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: More Stuff on May 5
image

@dtinianow
Copy link
Author

Priority 2 - Launch School: Exercises on May 6
image

@dtinianow
Copy link
Author

Priority 3 - Try Git on May 6
image

@dtinianow
Copy link
Author

Task A - Typing on May 6
image

@dtinianow
Copy link
Author

Task B - Logic Puzzles: Basic on May 6
image

@dtinianow
Copy link
Author

Task A - Typing on May 8
image

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