Skip to content

Instantly share code, notes, and snippets.

@MrAaronOlsen
Forked from mbburch/prework.md
Last active March 7, 2017 21:08
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 MrAaronOlsen/49435c74a7cac0e13820c8730b2c3359 to your computer and use it in GitHub Desktop.
Save MrAaronOlsen/49435c74a7cac0e13820c8730b2c3359 to your computer and use it in GitHub Desktop.
Aaron's Prework Gist

Turing School Prework - Aaron Olsen

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?

    • All is well.
  • How do you open Atom from your Terminal?

    • Decided on VS Code, and 'code' opens the program.
  • What is the file extension for a Ruby file?

    • .rb
  • What is the Atom shortcut for hiding/ showing your file tree view?

    • up cmd E. Easy click on side bar too.
  • 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?
    • print current directory
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
    • shows the systems host name. Wolverine.

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb?
    • Type irb into cmd line to start. Type exit or hit 'control D' to stop.
  • What might you use irb for?
    • Testing and exploring small bits of code quickly.

Variables

  • How do you create a variable?
    • Generally you create a variable by making it equal something. hello = "Hello", num = 7, hash = {}...
  • What did you learn about the rules for naming variables?
    • Variables can not start with a number or have operators in them (+, -, etc). They also can not have spaces in them.
  • How do you change the value of a variable?
    • By making it equal to something else or using one the many Ruby methods on it. hello = "Bye", hello.reverse!...

Datatypes

  • How can you find out the class of a variable?
    • By apending .class to it. "hello".class (string), num.class (Fixnum)...
  • What are two string methods?
    • .upcase, .each_char
  • How can you change an integer to a string?
    • 7.to_s

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
    • You can interpolate with double qoutes but not single.
  • What is this used for in Ruby: #{}?
    • This is used for interpolation on output.
  • How would you remove all the vowels from a string?
    • "Oogabooga".delete("aeiouAEIOU"), or "oogabooga".gsub!(/[aeiouAEIOU]/, "")

Input & Output

  • What do 'print' and 'puts' do in Ruby?
    • 'print' does not insert a new line like puts does.
  • What does 'gets' do in Ruby?
    • 'gets' gets input from user.
  • 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?
    • Ints are whole numbers; 1, 5000, 42... Floats 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?

    • ==
      • is equal to
    • =

      • is greater than or equal to
    • <=
      • is less than or equal to
    • !=
      • is not equal to
    • &&
      • and also this other thing
    • ||
      • or this other thing
  • What are two Ruby methods that return booleans?

    • .include?, .nil?

Conditionals

  • What is flow control?
    • Flow control is comparable to dicision making for programming by introducing if/else conditionals.
  • What will the following code return?
apple_count = 4

if apple_count > 5
  puts "Lots of apples!"
else
  puts 'Not many apples...'
end
  • => Not many apples... Since apple_count is not greater than 5 then the first condition is not met and the second conditional is executed.
  • What is an infinite loop, and how can you get out of one?
    • An infinite loop is a loop that will never meet a conditional to end, or is never true.
  • 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?
    • 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?
    • When used corectly they can make memory use more efficient by limiting the number of times Ruby needs to copy an object for reference.
  • Does naming symbols use the same rules for naming variables?
    • Yes. And no. When you assign a symbol to something it follows standard naming practices. The symbol itself follows standard naming practices with no qoutes, but when the symbol is a string you can name it whatever you like.
  • 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 initialized array.
    • pop removes the last element from an array.

Hashes

  • Describe some differences between arrays and hashes.
    • Arrays reference elements by index number[0, 1, 2...]. Hashes reference elements by key{"blue", "green", "red"...}
    • Arrays are initilized using []. Hashes are initilized with {}.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
    • If you have an ordered collection, or you don't care in which order a collection will be stored, and the objects in the list are the same arrays are a good choice.
    • If you need to access certain elements in the collection, you want to make your code more readable, or your storing different types of objects a Hash is probably better than an array.
    • 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 took my time. I made a terminal Connect4 game that forced me to really use Arrays and Hashes. I learned the hard way that when you make something = an object, it is actually that object and not a copy of that object. Ugh...
    • I also picked up Gosu and somehow started to make a physics engine. It works, mostly. This forced me to get into Classes, which...
  • What are you most looking forward to learning more about?
    • is what I'm most excited to learn more about. The power of OOP, particularly in Ruby, is very exciting, especially when a class starts to get used for more than you originally thought. And the fact that you can add to Ruby's classes to do things Ruby doesn't already do is really cool.
  • What topics would you most like to see reinforced by instructors?
    • At this point it's information control that I find the most complex. That is; how do classes message each other, how do you prevent information from getting passed too much, does something need to be a class or is it better as a module... For example, in my physics engine I have all sorts of things happening and that information can be sent to the programmer pretty easily. But what if the programmer want's to know if something specific happened, like a collision between a ball and a specific object, and then want's something to happen in responce that, like the ball's velocity is increased? It starts to get comlex there.
    • Which brings me to what I find the most perplexing...
  • What is most confusing to you about what you've learned?
    • How do you manage all of this on a team? Since I haven't done this yet it kinda freaks me out to know that a class I make would be used by someone else with out ever knowing what's inside it.
  • What questions do you have for your student mentor or for your instructors?
    • What are your favorite gems? I've been hesitant to add too many because I don't want to clutter up my bin.

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.
    • I did all five of them
  • Functions: How do you call a function and store the result in a variable?
    • You call a function and store it's result by simply making your variable equal to the function.
      • For example: def function; return "I am a function"; variable = function; puts function => "I am a function"
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
    • The initialize method tells Ruby how to set up your class when it is first called.
    • You call a class or make an instance of your class by calling a new method of that class.
    • Instance variable are variables in a class that only that class can see.
  • 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"?
@MrAaronOlsen
Copy link
Author

MrAaronOlsen commented Jan 25, 2017

Task D Ruby Version Shot

day1_versions

@MrAaronOlsen
Copy link
Author

cc_term1
cc_term2
cc_term3
cc_term4

@MrAaronOlsen
Copy link
Author

day2_io

day2_calc

@MrAaronOlsen
Copy link
Author

day3_cond_prog

day3_cond_term

@MrAaronOlsen
Copy link
Author

day3_nil

@MrAaronOlsen
Copy link
Author

day3_symbols

@MrAaronOlsen
Copy link
Author

day3_hashes

@MrAaronOlsen
Copy link
Author

loop challange 1

loop challange 2

@MrAaronOlsen
Copy link
Author

summary_challange_vote

summary_challange_echo

summary_challange_sum5

summary_challange_hash

summary_challange_array

@MrAaronOlsen
Copy link
Author

program_dice

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