Skip to content

Instantly share code, notes, and snippets.

@jk1dd
Forked from mbburch/prework.md
Last active January 21, 2017 23:55
Show Gist options
  • Save jk1dd/909035c51a58b1390fd9a777505dc0b6 to your computer and use it in GitHub Desktop.
Save jk1dd/909035c51a58b1390fd9a777505dc0b6 to your computer and use it in GitHub Desktop.
JK's Turing pre-work Gist

Turing School Prework - JK

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?

Just a couple warnings when I ran

brew doctor

seeming to come from Python which I already had installed on my system.

  • How do you open Atom from your Terminal?

I am assuming I replace "VS Code" for "Atom" in the above question? I enter code into the Terminal - I followed the instructions and added code as a variable to my $PATH variable list.

  • What is the file extension for a Ruby file?

Ruby files have the extenstion .rb

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

Not entirely sure what this question is referencing - ⌘b hides the left sidebar entirely. ⌘\ does something as well, along the lines of opening a new editing pane.

  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?

⌘Popens the 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?

pwd stands for 'present working directory.' it is useful as it lets you know where you are as you navigate around and do stuff via Terminal.

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

hostname is the label assigned to my device to identify it on a network. When I type hostname into terminal, I get Jonathans-MacBook-Pro-2.local

Task F- Learn Ruby:

Option 1 Questions:

IRB

worked through on 5 Jan
irb stands for interactive ruby interpreter

  • How do you start and stop irb?

type irb into the command line. To stop it, use quit, exit, or ctrl + D.

  • What might you use irb for?

irb can be used to experiment to see how features of the language work. You cannot save your work or edit text very well.

Variables

worked through on 5 Jan
variable = way to name a piece of data to do things with it. It will persist as long as the program is running.

  • How do you create a variable?

A variable is assigned using =

  • What did you learn about the rules for naming variables?

You cannot use dashes, all numbers, or start a variable name with a number. That leaves one with lower or uppercase letters, underscores, and numbers in the middle of or after letters. There may be other rules, and I remember hearing about certain conventions that are generally followed in Ruby. For example, the info here.

  • How do you change the value of a variable?

To change the value of a variable, you reassign a new value to that original variable.

Datatypes

worked through on 6 Jan

  • How can you find out the class of a variable?

To find out the class of a variable, call the class method on it.

  • What are two string methods?

To string methods are upcase and chars. upcase capitalizes all the letters in a string. chars creates an array of each character in the string (I had to look that up). If you want to call all the possible methods on an object of a certain class, you can use the methods method.

  • How can you change an integer to a string?

To change an integer to a string, use the coversion method of to_s on the integer object (is that the right way to say that?).

5.to_s

Strings
worked through on 6 Jan

  • Why might you use double quotes instead of single quotes in Ruby?

Using double quotes allows you to use string interpolation (inserting a Ruby statement in another string). I could also see the benefit if you were using a contraction in a string ("Jonathan's notebook") rather than having to use an escape character.

  • What is this used for in Ruby: #{}?

The #{} thing is used for string interpolation, which allows one to insert a Ruby statement in another string.

  • How would you remove all the vowels from a string?

One way to do it would be to use the delete method. You append the other string to be deleted after the method:

"string".delete('aeiou')

Input & Output

  • What do 'print' and 'puts' do in Ruby?

'puts' (short for put string) prints the information to the user followed by a new line. 'print' prints the information to the user, but does not add a new line to the end. They both return a value of 'nil'.

  • What does 'gets' do in Ruby?

'gets' is short for "get string." It waits to recieve input from the user of 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?

An integer is a whole number. A float is a decimal. Perform an operation on two integers, you get an integer. Perform an operation on an integer and a float, or a float and a float, and you get a float. +, -, and * work interchangeably, whereas / will truncate when dividing integers.

  • 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?

comparison operators

  • == checks for equality
  • = greater than or equal to

  • <= less than or equal to
  • != does not equal
  • && and
  • || or
  • What are two Ruby methods that return booleans?

Two examples of Ruby methods that return booleans are end_with? and include?. Others can be noticed by the use of a ? in the method name.

Conditionals

  • What is flow control?

Flow control allows the program to make decisions, based on information (e.g. user input, computation result, or value returned by different part of the program). if...else...end

  • What will the following code return?
apple_count = 4

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

The above code will return the string "Not many apples...". It tests whether the if statement is true based on information given, and then puts the result based on that.

  • What is an infinite loop, and how can you get out of one?

An infinite loop is a while loop that has no way out, no way to make the loop false - while loops run until they are untrue. To get out of one, hit 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?

nil is a Ruby data type representing "nothing." In other languages, it is signified by null or None. puts puts a string, but always evaluates to nil

  • 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?

One advantage of a symbol is its immutability - it cannot be changed. Additionally, symbols save memory over a large number of identical strings, and so can improve performace.

  • Does naming symbols use the same rules for naming variables?

Naming symbols and naming variables seem to follow the same rules.

  • 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?

The method length can be called to find out how many elements there are in an array. E.g. array.length.

  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?

The index of pizza in the above array is 0. Idex begins from zero. You can also use negative index, e.g. array.[-1] will be the last element in the array.

  • What do 'push' and 'pop' do?

'push' modifies the array by appending an item to the end of the array. E.g. array.push('string') would add 'string' onto the end of 'array'. 'pop' removes the last item, pops it off.

Hashes

  • Describe some differences between arrays and hashes.

Arrays are used to work with large groups of similar items, ordered lists, with items accessed by their index. In hases, which store pairs of keys and values, items are accessed by their key, a good way to work with large ammounts of associated data. This link from a stackoverflow discussion lays it out.

  • What is a case when you might prefer an array? What is a case when you might prefer a hash?

I would prefer an array when the information is in a certain order, whereas I would prefer using a hash when I needed to reference information by its 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 got through the Week work no problem, and then finished up the Railsbridge stuff and got through most of the Launch School course as well. It had some stops and starts because of travel and holidays, but when I had uninterrupted time (from 2nd week of Jan on), it went along great, where I learned new things as well as reviewed topics learned in the previous days.

  • What are you most looking forward to learning more about?

I have really enjoyed digging into this, though I know I have just scratched the surface. I am looking forward to going deeper with the practical programming skills, and also really looking forward to getting a better sense of the "big picture," like why and when I would be applying these techniques. I also want to learn lots more hotkeys and shortcuts and get faster moving around my machine and my work. I like that.

  • What topics would you most like to see reinforced by instructors?

I suppose I trust the instructors and the course materials to reinforce those topics which are most important to master to be a professional web developer. I understand that there is really no end to how deep you can go, so I am looking for guidance to focus my energies. I also think that as time goes on, I will find topics I want to dig into more for my own interest, but it is too soon to tell.

  • What is most confusing to you about what you've learned?

I am most confused about different sorts of objects and how they relate to one another, like how there are different kinds of variables that can be accessed at different (and overlapping) levels (constants, global, class, instance, local). I need a better grip of how the whole thing works overall. Another thing I find confusing is the terminology - there is a whole other English language used to describe all the pieces used in programming. I hope to be able to accurately form my questions by learning what words to use!

  • What questions do you have for your student mentor or for your instructors?

None at this moment. I have learned a lot about digging into documentation as well as Googling the heck out of issues I have had with the intro stuff. I am sure I will have lots of questions as we get started, though.

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 went ahead and did all of them, they were pretty straightforward. I think there is most likely a more efficient manner to meet the same requirements, though. I'll post the one I am especially wondering about in the comments.

  • Functions: How do you call a function and store the result in a variable?

To call a function (that you have already created, using def...end with the guts in between), you use the name of function with an arguement in parentheses and set it equal to a variable. e.g. headphones = function("string")

  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.

    • initalize method - method that saves inital data an object is created with, and performs any other "setup." Every class must contain an initialize method.
    • new method - creates and instance of your object. Object.new(arg). Args are passed to the initalize method.
    • instance variables - behave like local variables, but only visible from inside a specific 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.

Launch School Ruby Book

  • screenshots will be posted in comments
  • What are your three biggest takeaways from working through this book?

-I really liked the section on how to read Ruby documentation. -The course was written very clearly - reinforced what I did in the Railsbridge curriculum as far as the basics, and also mentioned/hinted at other topics that relate and will come up as I go deeper into learning Ruby. -The examples were very useful, well written and I appreciated the video walkthroughs.

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

jk1dd commented Dec 2, 2016

Here's the warnings I got from Homebrew, working on Day One, Task D:
screenshot 2016-11-30 18 50 42 homebrew warnings
Not sure if it will be an issue for the upcoming prework activities?

@jk1dd
Copy link
Author

jk1dd commented Dec 30, 2016

Screenshots for lessons 1-5 on typing.io. I did these a while ago, finally getting my Gist updated.

screenshot 2016-12-04 18 45 39 typing io ruby 1
screenshot 2016-12-30 11 34 41 typing io 2
screenshot 2016-12-30 11 50 03 typing io 3
screenshot 2016-12-30 11 06 15 typing io 4
screenshot 2016-12-30 11 22 27 typing io 5

@jk1dd
Copy link
Author

jk1dd commented Jan 5, 2017

Task E - Command line. Again, worked my way through this but did not post screenshots as I went along.

screenshot 2017-01-05 09 30 11 codecademy pt 1
screenshot 2017-01-05 09 45 17 codecademy pt 2
screenshot 2017-01-05 09 45 42 codecademy pt 3
screenshot 2017-01-05 09 46 13 codecademy pt 4

@jk1dd
Copy link
Author

jk1dd commented Jan 6, 2017

From Task F, "Input and Output", here is "I/O" program:

screenshot 2017-01-06 10 43 11 i_o program

I initially used 'puts' to for the first question, but wanted to give the user a prompt of some sort, so I went with 'print' instead.

@jk1dd
Copy link
Author

jk1dd commented Jan 6, 2017

"Numbers":
screenshot 2017-01-06 10 54 12 calc

@jk1dd
Copy link
Author

jk1dd commented Jan 6, 2017

Typing.io Ruby ex. 6
screenshot 2017-01-06 13 12 00 typing io 6

@jk1dd
Copy link
Author

jk1dd commented Jan 6, 2017

Typing.io 7
screenshot 2017-01-06 13 16 11 typing io 7

@jk1dd
Copy link
Author

jk1dd commented Jan 6, 2017

"Conditionals" challenge - not extended challenge:
screenshot 2017-01-06 13 47 10 conditionals prog

@jk1dd
Copy link
Author

jk1dd commented Jan 9, 2017

"nil"
screenshot 2017-01-09 13 16 42 nil terminal

@jk1dd
Copy link
Author

jk1dd commented Jan 9, 2017

"Symbols":
screenshot 2017-01-09 13 56 07 symbols

@jk1dd
Copy link
Author

jk1dd commented Jan 9, 2017

typing.io 8

screenshot 2017-01-09 14 05 01 typing io 8

@jk1dd
Copy link
Author

jk1dd commented Jan 10, 2017

typing.io 9

screenshot 2017-01-09 14 42 41 typing io 9

@jk1dd
Copy link
Author

jk1dd commented Jan 10, 2017

Hashes:
screenshot 2017-01-10 09 54 11 hashes

@jk1dd
Copy link
Author

jk1dd commented Jan 10, 2017

Typing.io 10

screenshot 2017-01-10 11 48 58 typing io 10

@jk1dd
Copy link
Author

jk1dd commented Jan 10, 2017

Loops challenge:
screenshot 2017-01-10 12 47 41 loop_challenge

@jk1dd
Copy link
Author

jk1dd commented Jan 11, 2017

Typing.io 11
screenshot 2017-01-11 11 33 40 typing io 11

@jk1dd
Copy link
Author

jk1dd commented Jan 11, 2017

Number adder for Railsbridge Summary:Basics challenge. My program does what is asked, but I think there must be a more efficient way than asking for each number separately.
screenshot 2017-01-11 14 37 58 number_adder

@jk1dd
Copy link
Author

jk1dd commented Jan 18, 2017

typing.io 12
screenshot 2017-01-18 13 49 53 typing io 12

@jk1dd
Copy link
Author

jk1dd commented Jan 18, 2017

typing.io 13
screenshot 2017-01-18 13 55 13 typing io 13

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