Skip to content

Instantly share code, notes, and snippets.

@gprocell927
Forked from mbburch/prework.md
Last active June 26, 2016 20:24
Show Gist options
  • Save gprocell927/d6f4e1dcde514e91ebf0f3c6a6ae7627 to your computer and use it in GitHub Desktop.
Save gprocell927/d6f4e1dcde514e91ebf0f3c6a6ae7627 to your computer and use it in GitHub Desktop.
An example template for your Turing pre-work Gist

Turing School Prework - Gabrielle Procell

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?
  • How do you open Atom from your Terminal?
  • What is the file extension for a Ruby file?
  • What is the Atom shortcut for hiding/ showing your file tree view?
  • What is the Atom shortcut for quickly finding a file (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?
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?

Task F- Learn Ruby:

Option 1 Questions:

IRB

  • How do you start and stop irb?
  • What might you use irb for?

Variables

  • How do you create a variable?
  • What did you learn about the rules for naming variables?
  • How do you change the value of a variable?

Datatypes

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

Strings

  • Why might you use double quotes instead of single quotes in Ruby?
  • What is this used for in Ruby: #{}?
  • How would you remove all the vowels from a string?

Input & Output

  • What do 'print' and 'puts' do in Ruby?
  • What does 'gets' do in Ruby?
  • 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?
  • 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?
    • ==
    • =

    • <=
    • !=
    • &&
    • ||
  • What are two Ruby methods that return booleans?

Conditionals

  • What is flow control?
  • What will the following code return?
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?
  • 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?
  • 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?
  • Does naming symbols use the same rules for naming variables?
  • 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?
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
  • What do 'push' and 'pop' do?

Hashes

  • Describe some differences between arrays and hashes.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
    • 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?
  • What are you most looking forward to learning more about?
  • What topics would you most like to see reinforced by instructors?
  • What is most confusing to you about what you've learned?
  • What questions do you have for your student mentor or for your instructors?

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

Day 2 Prework

Task F - Option 1 Questions/Answers
IRB

How do you start and stop irb? Start irb by typing "irb" into the terminal. Stop irb by typing "exit" into the terminal.
What might you use irb for? You use irb to experiment and run Ruby code. It doesn't save your work, so it is not a good place to write a program in.

Variables

How do you create a variable? Type a name for a variable into irb and assign a value to it.
_What did you learn about the rules for naming variables?_Variables can be named using letters, an underscore, or a number at the end of the variable name.
How do you change the value of a variable? You change the value of a variable by using a singe equals sign (=). The right side of the equals sign will be evaluated and assigned to the variable named on the left side of the equals sign.

Datatypes

How can you find out the class of a variable? Call the class method on an object by typing the object or variable name, then a period, and then the method name.
What are two string methods?.chars, .private_methods
_How can you change an integer to a string?_Use an object's conversion method to translate it to a string. In this case it would be to_s.

Strings

Why might you use double quotes instead of single quotes in Ruby? You would use double quotes rather than single quotes in Ruby when you are using string interpolation. This only works in double quotes.
What is this used for in Ruby: #{}? string interpolation and a place to hold code for a Ruby statement.
How would you remove all the vowels from a string? .delete('aeiou')

Input & Output

What do 'print' and 'puts' do in Ruby? 'print' is a way of printing information to the user of the program, but it does not make a new line after printing. "puts" is also a way of printing information to the user of the program, and it will make a new line after printing.
What does 'gets' do in Ruby? 'gets' (get string) pauses the program to wait for the user to enter data and hit the enter key. Then it returns the value entered to the program and continues execution 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".
conditionalchallenge

cd practice
cdpractice
ls practice
lspractice1
lspractice2
lspractice3
mkdir practice
mkdirpractice
untitled

typing practice

day2typing1
day2typing2
day2typing3
day2typing4

Dinner Date Quiz

day2dinnerdatequiz

@gprocell927
Copy link
Author

Day 3 PreWork

Day 2 cont'd
Numbers & Arithmetic

What is the difference between integers and floats? Integers are whole numbers (10), while floats are numbers with decimals (3.14).
Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
numbers

Booleans

What do each of the following symbols mean?
== equals

= greater than or equal to
<= less than or equal to
!= the opposite of
&& and
|| or
What are two Ruby methods that return booleans? .empty? .nil?

Conditionals

_What is flow control?_A way of selectively executing code based on values that exist in the program.
What will the following code return?
apple_count = 4

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

The code will return 'Not many apples...'
What is an infinite loop, and how can you get out of one? An infinite loop happens when your loop body doesn't do anything to make the while condition false. To get out of an infinite loop, terminate the program by typing ctrl+c
Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
conditionals

nil

What is nil? A Ruby data type that means "nothing". It is used to show that a variable hasn't been assigned to anything yet, or that a function didn't return a value.
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
nil

Symbols

_How can symbols be beneficial in Ruby?_Symbols help Ruby use memory more efficiently.
_Does naming symbols use the same rules for naming variables?_yes
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols"
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' is a method that adds a new element to the end of the array. 'pop' is a method that will remove (and return) the element at the end of the array.

@gprocell927
Copy link
Author

Hashes

_Describe some differences between arrays and hashes._Arrays are used more for storing an ordered list of items, and you can access elements in an array by their position. With hashes, pairs of items are stored associated with keys and values. You can ask a has for an array of its keys or values. In arrays, elements are accessed by their index. In hashes, elements are accessed by their key.
What is a case when you might prefer an array? What is a case when you might prefer a hash?
* Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".

@gprocell927
Copy link
Author

hashes

hashes

@gprocell927
Copy link
Author

Day 3 Prework.

Task E

rmdir

rmdir

@gprocell927
Copy link
Author

Day 3 prework - Moving around (pushd, popd)

pushdpopd

Day 3 typing

day3typing1

Day3 Quiz (Algorithm)

algorithmquiz1
algorithmquiz2
algorithmquiz3
algorithmquiz4
algorithmquiz5

@gprocell927
Copy link
Author

Day 4 Prework

Typing practice

day4typing1
day4typing2
day4typing3

Copy A File

copyafile

Making Empty Files

makingemptyfiles

Move a File

@gprocell927
Copy link
Author

movefile

@gprocell927
Copy link
Author

Day 5 Pre work

View A File

viewafile

Stream a file

catex

Removing A File

rmex

Typing and Quiz practice

day5quiz
day5type2
day5type
day5type3

@gprocell927
Copy link
Author

Day 6 Prework

Loops challenge

loopschallenge1
loopschallenge2

Summary:Basics

Months of Year Program:

monthsyear

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

You call a function by stating the name of the function, then sending in the values that the function needs to carry out its task. The result can be stored in a variable by assigned the function to a variable. Ex: your function is: backwards 'Hello'
To store this into a variable would look like this: mirror = backwards 'Hello'

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

Initialize method: a method that 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 sent to your initialize method.
Instance variables: Instance variables behave like normal variables, but are only visible from inside a specific instance of your object. Data is stored on your object using instance variables that start with an @ sign.

@gprocell927
Copy link
Author

My experience with "How to Write a Program" in the Railsbridge Curriculum

Although this exercise seemed simple enough, there were moments where this program felt like one of the most complex ideas..ever.

What I found most challenging was trying to organize the program. I felt that I had some understanding of what components needed to be in the program, but I had trouble grasping why the code was placed where it was. I think that reviewing functions, arrays, and loops may help to clear this up for me along with a possible flow chart or two.

What I enjoyed the most about creating the program was getting it to work after attempts in which the code would not work. Coming back to this program a couple of days later and having an "a-ha!" moment was very relieving. Seeing how all of the pieces fit together was also an uplifting moment. Basically, I like it when I feel that I finally understand things.

@gprocell927
Copy link
Author

gprocell927 commented May 30, 2016

Launch School's Ruby Book

Exercise: Using the Command Line and irb

irbtest

commandline
ruby
my_foldermkdir

@gprocell927
Copy link
Author

Basics (Launch School Ruby Exercises)

  1. Add two strings together that, when concatenated, return your first and last name as your full name in one string.
    addstrings
    2)Use the modulo operator, division, or a combination of both to take a 4 digit number and find the digit in the:

  2. thousands place

  3. hundreds place

  4. tens place

  5. ones place
    thousandhundredtenone
    3)Write a program that uses a hash to store a list of movie titles with the year they came out. Then use the puts command to make your program print out the year of each movie to the screen.
    movies

  6. Use the dates from the previous example and store them in an array. Then make your program output the same thing as exercise 3.
    dates

5)Write a program that outputs the factorial of the numbers 5, 6, 7, and 8.
factorial
6)Write a program that calculates the squares of 3 float numbers of your choosing and outputs the result to the screen.
squares
7) _What does the following error message tell you?

SyntaxError: (irb):2: syntax error, unexpected ')', expecting '}'
from /usr/local/rvm/rubies/ruby-2.0.0-rc2/bin/irb:16:in `

'_
The error message tells me that there is an opening bracket somewhere that is not closed, this may be from a hash that was created.

@gprocell927
Copy link
Author

Launch School Ruby Book

Variables Exercises

Ex 1:
ex1
Ex 2:
ex2
Ex 3:
ex3
Ex 4:
ex4
Ex 5:
x will print 3 to the screen in the first program because the variable x is initially set at a value of 0, and is incremented by 1 three times in the do/end block. X will not print anything in the second program, because an error will occur since x is being called outside of the do/end block and is not available outside of that block.
Ex 6:
The error message tells us that that variable 'shoes' is being called in a scope where it is not yet defined.

@gprocell927
Copy link
Author

Learning Ruby Methods Exercises

Exercise 1

ex1

Exercise 2

ex2

Exercise 3

ex3

Exercise 4

The code will not print anything (it returns nil).

Exercise 5

pt 1:
ex4
pt 2: The code still returns nil

Exercise 6

A method is being called that asks for 2 arguments, but only one has been provided.

@gprocell927
Copy link
Author

Flow Control Exercises

Ex. 1:

ex1

Ex. 2:

ex2

Ex. 3 :

ex3

Ex 4:

  1. False
  2. Did you get it right?
  3. Alright now!

@gprocell927
Copy link
Author

Flow Control Exercises (pt 2)

Ex 5:

ex5a
ex5b

Ex 6:

You get the error because only the if/else statement was ended, and the method was not ended. To fix this, end the equal_to_four method.

@gprocell927
Copy link
Author

Loops and Iterators Exercises

Ex 1:

The each method will return the array of [1, 2, 3, 4, 5]

Ex 2:

ex 2

Ex 3:

ex 3

Ex 4:

ex4

@gprocell927
Copy link
Author

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 minimal tasks and some of the priority tasks. I took my time with them.

What are you most looking forward to learning more about? I'd like to learn more with Ruby and how to apply it in a broader scheme.
What topics would you most like to see reinforced by instructors? Formatting code --more specifically I'd like to reinforce the order in which certain things should fall.
What is most confusing to you about what you've learned? What the best way to lay out my program would be.
What questions do you have for your student mentor or for your instructors? None at this time other than what was previously mentioned.

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