Skip to content

Instantly share code, notes, and snippets.

@tmikeschu
Forked from mbburch/prework.md
Last active September 30, 2016 13:25
Show Gist options
  • Save tmikeschu/53aa051fbed621121640dee3c263a0fb to your computer and use it in GitHub Desktop.
Save tmikeschu/53aa051fbed621121640dee3c263a0fb to your computer and use it in GitHub Desktop.
Turing Pre-work Gist (tms)

Turing School Prework - Mike Schutte

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?
  • My admin name was T. Mike Schutte, but something that the ruby download referenced needed it to be only "Mike Schutte". Quick resolution, but a good reminder to keep it consistent. I also was warned to add "source ~/.profile" to my bash profile after dowloading the RVM package.
  • How do you open Atom from your Terminal?
  • I followed the document over the video since it is newer, so I went with VS Code. To open it, I run the "code" command in the Terminal.
  • What is the file extension for a Ruby file?
  • .rb
  • What is the Atom shortcut for hiding/ showing your file tree view?
  • Not sure if it is the same as in Atom, but command+B toggles the sidebar, and command+shift+E selects the file tree view.
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?
  • Command+P engages a quick search feature for the directory. (I think this is what is meant by fuzzy finder?)

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. This reminds the programmer where they are in their directory tree. It's like referencing a map or compass.
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
  • hostname tells the programmer the name of the computer, my hostname is " Mikes-MacBook-Air.local "

Task F- Learn Ruby:

Option 1 Questions:

IRB (Day 2)

  • How do you start and stop irb?
  • Start with the "irb" command, stop with the "exit" command.
  • What might you use irb for?
  • Useful for experimenting with language features

Variables

  • How do you create a variable?
    • set a certain name equal to a value (number, string, etc.). e.g., [ new_var = "new variable" ]
  • What did you learn about the rules for naming variables?
    • They cannot start with numbers or include hyphens.
  • How do you change the value of a variable?
    • Execute a new command with that variable set equal to the new value.

Datatypes (Day 3)

  • How can you find out the class of a variable?
  • {variable name}.class
  • What are two string methods?
  • .upcase , .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?
  • Double quotes allow the #{} interpolation feature. It would also allow the use of single quotes within the string without needing a "" escape.
  • What is this used for in Ruby: #{}?
  • Interpolating Ruby variables or expressions into strings.
  • How would you remove all the vowels from a string?
  • "some string with vowels".delete("aeiou")

Input & Output

  • What do 'print' and 'puts' do in Ruby?
  • 'print' provides a string output without a line break, puts does the same with a line break.
  • What does 'gets' do in Ruby?
  • 'gets' pauses the program until the user inputs a value and presses 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?
  • Integers are whole numbers, floats have decimals. Floats converted to integers round down.
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".

Booleans (Day 4)

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

    • <= less then
    • != not equal to
    • && and
    • || or
  • What are two Ruby methods that return booleans?
  • .end_with?('letter' or integer)
  • .empty?
  • .include?

Conditionals (Day 5)

  • What is flow control?
  • Teaching the machine to make value-dependent decisions based on things like user input.
  • What will the following code return?
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end

This will return "Not many apples..."

  • What is an infinite loop, and how can you get out of one?
  • Infinite loops happen when the program never evaluates to false. Control+C escapes 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 (Day 6)

  • What is nil?
  • Nil is a value of nothing (not the same as zero). More like "nothing yet."
  • 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?
  • Instead of repeating variable values, symbols stand as a constant and helps save memory.
  • Does naming symbols use the same rules for naming variables?
  • Symbols must start with a colon, and are not set to values.
  • 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"]?
  • index = 0
  • What do 'push' and 'pop' do?
  • 'push' adds an element to the end of an array, "pop" removes an element (the last, if unspecified)

Hashes

  • Describe some differences between arrays and hashes.
  • Arrays store series of individual values, hashes have key-value pairs. Arrays are better for storing lists that need ordering, while hashes are more helpful for storing properties info about and object.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
  • An array would be helpful for storing a list of book titles available in a book shop. A hash would be a good way to store the book titles (as values) with the authors (as the keys).
    • 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 exercises in a good rhythm, I think. I liked breaking it off into a couple hours per day.
  • What are you most looking forward to learning more about?
  • I look forward to making a habit of thinking in pseudo-code / just thinking more algorithmically and logically. I also want to know how these general features of Ruby get applied to web/app development. I'm also hoping to get more of a theoretical understanding of programming and algorithms. Some of the Brilliant quizzes were super tough.
  • What topics would you most like to see reinforced by instructors?
  • Control flow and parsimony.
  • What is most confusing to you about what you've learned?
  • All of the technical stuff (Ruby and Command Line) was pretty straightforward. I'm still confused by some of the more abstract/theoretical problems posed in the warm-up quizzes.
  • What questions do you have for your student mentor or for your instructors?
  • Where does the technical know-how of programming meet the theoretical problem solving part? The gap seems wide to my beginner eyes!

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, enter its name, followed by its required values as defined in the 'def' statement.
  • To store this as a variable, set a variable name equal to the called function and respective value(s).
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
  • Initialize stores the starting data needed associated with the object. Instance variables are set within the initialize method.
  • .new creates an instance of the created object.
  • Instance variables are endemic to and thus only available within the defined instance of the 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.
  • After going through each lesson separately, I found it challenging at first to integrate all I've learned. After a while though, it became fun and mroe intuitive.
  • Most enjoyable: I loved breaking down the program into smaller methods and thinking of ways to make the program more parsimonious.

Launch School Ruby Book

  • screenshots will be posted in comments
  • What are your three biggest takeaways from working through this book?
    1. It's much easier to read code than words about code!
    1. Practicing and building programs is fun.
    1. I have a lot more repetition to do!

CodeSchool

  • screenshots will be posted in comments
  • What are your two biggest takeaways from working through this tutorial?
  • International collaboration ability is incredible, and requires careful attention to detail.
  • What is one question you have about Git & GitHub?
  • How do Ruby, the command line, and text editors fit in with this? Is it all done after the fact, or during?

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?
  • Add the -n option between the 'echo' command and 'hello' argument > echo -n hello
  • 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
  • Ctrl-A moves the cursor to the beginning of the command, Ctrl-E to the end, and Ctrl-U clears all the characters to the left of the cursor.
  • 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
  • Clear: 'clear' or ^L
  • Exit: 'exit' or ^D
  • 2.1: What is the "cat" command used for? What is the "diff" command used for?
  • With one argument, 'cat' simply prints the entire file to the standard output. With multiple arguments, 'cat' concatenates the arguments in order.
  • 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?
  • curl -Ol (I found that the -L option helps if the URL redirects automatically)

  • 3.3: Describe two commands you can use in conjunction with "less".
  • ^F and ^B go Forward and Backward one page, respectively. : /"string" searches for "string" in the file.
  • 3.4: What are two things you can do with "grep"?
  • You can pipe the command history into grep to review particular uses of a command. Grepping is also useful for searching for substrings.
@tmikeschu
Copy link
Author

Typing:
typing1
typing2
typing3
typing4
typing5

@tmikeschu
Copy link
Author

Logic:

logic1 logic2

@tmikeschu
Copy link
Author

Typing:
typing1
typing2
typing3
typing4
typing5

@tmikeschu
Copy link
Author

Logic:
screen shot 2016-09-29 at 8 38 26 amscreen shot 2016-09-29 at 8 40 58 am

@tmikeschu
Copy link
Author

Typing:
screen shot 2016-09-30 at 7 17 46 am
screen shot 2016-09-30 at 7 19 45 am
screen shot 2016-09-30 at 7 22 24 am
screen shot 2016-09-30 at 7 25 16 am

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