Skip to content

Instantly share code, notes, and snippets.

@rdavid1099
Forked from mbburch/prework.md
Last active June 25, 2016 13:22
Show Gist options
  • Save rdavid1099/c4d884e75f8e83a04d3f83d71697a161 to your computer and use it in GitHub Desktop.
Save rdavid1099/c4d884e75f8e83a04d3f83d71697a161 to your computer and use it in GitHub Desktop.
Ryan Workman's Turing pre-work Gist

Ryan's Turing School Prework

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:

  • Completed

Task D- Set up your Environment:

  • Did you run into any issues?
    • Yes, Brew Doctor found several issues with files throughout my directory. I typed in the alternative PATH but did not alleviate the issue. I am working on partitioning my drive and booting up a clean OS to solve the problem.
  • How do you open Atom from your Terminal?
    • Type atom 'filename' in the command line of the terminal.
  • What is the file extension for a Ruby file?
    • .rb
  • What is the Atom shortcut for hiding/ showing your file tree view?
    • Cmd-Shift-\
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?
    • Cmd-T

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
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
  • Hostname tells you your computer's network name. My computer's network name is ryanworkmansPro.hsd1.co.comcast.net

Day Two Tasks:

  • Learned how to make directories using the command mkdir
  • Learned how to move throughout directories using cd
  • Learned how to list out the files in a directory using ls. I can also get a more complete and detailed list using ls -la and can see everything within a directory us ls -lR.
  • Photos of all my tasks are in the comments

Day Three Tasks:

  • I'm getting more comfortable with navigating the directories, moving files, making files and opening programs through the terminal.
  • I know how to delete empty directories using rmdir
  • I also see just how useful the pushd and popd commands will be when I need to fly around different directories

Day Four Tasks:

  • I am getting much more comfortable with the terminal and understand how it interacts with the OS. I am making an effort to solely use the terminal to move files, make files and copy files.
  • Today I learned how copy files, rename them and copy them into brand new directories.
  • I also learned how to copy directories using cp -r along with moving and renaming files and directories using the mv command.

Day Five Tasks:

  • I learned how to create a .txt file using touch and edit it using vim.
  • I also learned two different ways to view files in the terminal using cat and less. cat is used when it's a relatively small file and most of the text fits on a single screen. less is useful for larger files and allows you to page through all the text.
  • rm deletes or "removes" files.

Day Six Tasks:

  • I learned how to use pipes and arrows to navigate through the terminal more efficiently.
  • I can copy text files into other text files using cat ... > ...
  • I also now understand the find command works using "find STARTDIR -name WILDCARD -print"

Task F- Learn Ruby:

Questions:

IRB

  • How do you start and stop irb?
  • Enter 'irb' in the command line of the terminal to start running the interactive ruby interface. To quit, simply type exit.
  • What might you use irb for?
  • irb shows you how certain lines of code or phrases work. It doesn't save any code and isn't a great place to write full programs. It's a great place to test out certain phrases to understand the result. Variables
  • How do you create a variable?
  • You create a variable by simply typing out a string and putting an equals sign assigning a value to it.
  • What did you learn about the rules for naming variables?
  • Variables must follow a specific set of rules. Constants (true,false,numbers,etc.) cannot be variables. A variable cannot begin with a number or have a dash anywhere in the string.
  • How do you change the value of a variable?
  • You change the value of a variable by simply assigning it a different value.

Datatypes

  • How can you find out the class of a variable?
  • Type 'variable_name'.class
  • What are two string methods?
  • String.methods -- module_exec and ancestors are just two types of string methods
  • 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?
  • Use double quotes when you are including an interpolation variable
  • What is this used for in Ruby: #{}?
  • Interpolation is used to include variables into strings
  • How would you remove all the vowels from a string?
  • "This is a string".delete('aeiou')

Input & Output

  • What do 'print' and 'puts' do in Ruby?
  • print prints a string to the screen but it does not create new line after the string. puts prints a string to the screen and creates a new line.
  • What does 'gets' do in Ruby?
  • gets stands for "get string" and it allows a user to input a string or value into a variable.
  • Screenshot of I/O Challenge posted in comments below.

Numbers & Arithmetic

  • What is the difference between integers and floats?
  • Integers are whole numbers while floats are decimals.
  • An integer plus an integer will return an integer. A float plus a float will return a float. A float plus an integer will return a float.
  • Photo of challenge posted in comments. Titled "Caluclation Challenge."

Booleans

  • What do each of the following symbols mean?
    • ==
    • Equals
    • =

    • Greater than or equal to
    • <=
    • Less than or equal to
    • !=
    • Does not equal
    • &&
    • And - Both arguments must be true to return true
    • ||
    • Or - Any of the arguments must be true to return true
  • What are two Ruby methods that return booleans?
  • .empty? or .include?(_)

Conditionals

  • What is flow control?
  • If... elsif... else statements. It's when the program makes decisions dependent on what the user does.
  • What will the following code return?
  • Since four is less than five the program will print "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 is when you set up parameters that the program will never be able to break... thus the program never ends.
  • 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 basically means the variable has nothing in it. It is not an integer or float or sting, it's just null.
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
  • Posted screenshot of a basic program I created to further understand nil and how to test for it.

Symbols

  • How can symbols be beneficial in Ruby?
  • Symbols allow you to save memory by pointing out the same object in several places without tying up storage creating new objects.
  • Does naming symbols use the same rules for naming variables?
  • No. You must use a colon before naming symbol. You have also have spaces using double quotation or single quotation marks.
  • 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?
  • ARRAY_NAME.length
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
  • array[0] == "pizza", array[1] == "ice cream", array[2] == "cauliflower"
  • What do 'push' and 'pop' do?
  • When applied to an array .push adds an element to the end of the array. When applied to an array .pop returns the final element in an array and removes it from the array.

Hashes

  • Describe some differences between arrays and hashes.
  • Arrays allow you to store a list of items and call them up by their index number. They are great when you have an ordered list of items and know where each item will fall. Hashes allow you to store items and give them a key. Instead of using index numbers, like arrays, you can call up an item using its key.
  • What is a case when you might prefer an array? What is a case when you might prefer a hash?
  • An array would be good if I am listing the top 10 movies of all time. Each movie is listed in a specific section, and I know that if I want to call up the fifth best movie, I would refer to index number 4. Hashes on the other hand are great if you are making a list of several items that do not have a specific order or value. A list of cars allowed to park in a specific parking lot would use hashes.
    • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".

Pre-work Tasks- One Month Schedule

Railsbridge Curriculum, cont.

  • Loops: Take a screenshot of your "Challenge" program, and post it as a comment in your Gist.
  • Screenshot of challenge posted in comments below.
  • What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
  • I nested all of the basic summary programs into a single program. Screenshots provided below.
  • Functions: How do you call a function and store the result in a variable?
  • Functions allow you to break up specific parts of a program and easily recall them throughout the code.
  • A function is defined using def FUNCTION_NAME (VARIABLE) ...code in between... end.
  • You can store the result in a variable by using the command VARIABLE = FUNCTION_NAME ( X )
  • Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
  • A new object is defined using the "class" keyword followed by the name of the object
  • After creating a new object use "def initialize(VARIABLE)" to create initialize a method
  • Within the new object's parameters, use the @ symbol to create new instance variables
  • After your new object is defined and ended you can call the method using NEW_OBJECT_NAME.new(VARIABLE) and call the different methods NEW_OBJECT_NAME.METHOD_NAME.
  • 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.
  • Building the dice program was a great way to see how all of the elements I have been learning over the past week fit together in a larger program. The walkthrough helped look at how we could make a workable program in step 4 into a much more understandable and efficient program in step 8.
  • The most challenging part for me will be looking at an overall design and not over-complicating it. During each of the challenges over the past week, I've had a tendency to make the programs more complicated than they need to be which led to an inefficient and clunky design. I'm going to spend a lot more time going over functions and classes, learning how to better utilize those systems to make more efficient codes.
  • Screen shots saved in the comments.

Launch School Ruby Book

  • screenshots will be posted in comments
  • What are your three biggest takeaways from working through this book?
  • Ruby has a lot of power, but, with great power comes great responsibility. A lot of my programs quickly became large, clunky messes of code. The book showed just how important a role well-used classes and methods play as your code grows and more people get involved.

Prework Reflection:

  • Were you able to get through the work? Did you rush to finish, or take your time?
  • I worked through most of the prework including the extra month of the prework. I took my time and can't wait to dive deeper into unlocking the power of Ruby.
  • What are you most looking forward to learning more about?
  • It sounds like a cop-out, but I look forward to learning everything. More than anything, I want to fully understand Object-Oriented Design. As I was telling my student mentor, I have a tendency to build very clunky and hard to change programs. I want to get better at Object-Oriented Design.
  • What topics would you most like to see reinforced by instructors?
  • As I said in the previous answer, I want to better understand the proper use of classes, methods and symbols. I feel like a lot of my variables and clunky functions could have been cut back significantly.
  • What is most confusing to you about what you've learned?
  • I have a tendency to get too caught up in a certain concept and overlook more efficient and easier ways to get things done. One of the more confusing concepts, which I have been working a lot with lately, is RubyIO. The Launch book just kind of threw me in the deep end and left me with a lot of questions. Since then, I have made a few simple programs to better understand the concept, but I'm still a bit confused.
  • What questions do you have for your student mentor or for your instructors?
  • I think I asked all my questions as they came up. Overall, I'm excited to get started and can't wait to work with everyone in my class.
@rdavid1099
Copy link
Author

First Day of Typing Practice (Section A):
I got about half way through the Javascript typing practice. I will work my way through Ruby tomorrow.

524 typing1
524 typing2

@rdavid1099
Copy link
Author

Update... I'm using an iMac and haven't updated the OS since 10.6. Obviously, it's now severely outdated, and I can't run any of the programs we need including Spotlight, Atom and HomeBrew. I've been working on updating the OS for the past two days. OS 10.11 should be up and running by this afternoon, and I will finish all of my day one and two tasks then.

@rdavid1099
Copy link
Author

Second Day of Typing Practice (Section A):
Completed Javascript practice.
526 typing1
526 typing2

@rdavid1099
Copy link
Author

5/26 Logic Puzzles Practice
526 logic

@rdavid1099
Copy link
Author

5/27 Typing Exercise (Ruby) and Logic Puzzles Practice
527 typing1
527 typing2

527 logic

@rdavid1099
Copy link
Author

5/27 Terminal exercises
pwd
pwd

hostname
hostname

@rdavid1099
Copy link
Author

5/27 Learning mkdir, cd, and ls
screen shot 2016-05-27 at 10 19 19 am
screen shot 2016-05-27 at 10 26 42 am
screen shot 2016-05-27 at 10 27 45 am
screen shot 2016-05-27 at 10 28 34 am
screen shot 2016-05-27 at 10 34 26 am

@rdavid1099
Copy link
Author

5/28 Typing and Logic
Completed Ruby typing practice... and today's logic quiz kicked my ass.
528typing1
528typing2
528logic

@rdavid1099
Copy link
Author

Day Three Terminal Command Lines:

pushdpopd

rmdir

@rdavid1099
Copy link
Author

I/O Challenge
iochallenge

@rdavid1099
Copy link
Author

Calculation Challenge
calculationchallenge

@rdavid1099
Copy link
Author

Conditionals
conditionalschallenge

@rdavid1099
Copy link
Author

Practicing with nil
nilpractice

@rdavid1099
Copy link
Author

Understanding symbols
symbols

@rdavid1099
Copy link
Author

Hashes exercises
hashes

@rdavid1099
Copy link
Author

Loops Challenge
loopschallenge

@rdavid1099
Copy link
Author

Basic Summary Challenges
summary1
summary 2
summary 3
summary 4
summary 5

@rdavid1099
Copy link
Author

Dice Program
dice

@rdavid1099
Copy link
Author

Launch's Ruby Book Exercise 1
launchexercise1

@rdavid1099
Copy link
Author

Launch's Ruby Book Exercise 2
launchexercise2

@rdavid1099
Copy link
Author

Launch's Ruby Book Exercise 3
launchexercise3

@rdavid1099
Copy link
Author

Launch Ruby Book Exercise 4
launchexercise4

@rdavid1099
Copy link
Author

Launch Ruby Book Exercise 5
launchexercise5

@rdavid1099
Copy link
Author

Launch Ruby Book Exercise 6
launchexercise6a
launchexercise6b
launchexercise6c

@rdavid1099
Copy link
Author

Launch Ruby Book Exercise 7
screen shot 2016-06-10 at 8 54 39 am
launchexercise6a

@rdavid1099
Copy link
Author

Launch Ruby Book Exercise 8
I was able to work through all of the exercises successfully. However, question 6 (asking to create a code to pull out all of the anagrams in an array) completely threw my for a loop. I had no idea how to execute that program and after looking at the solution, I'm still confused. I tried running the code they provided in the solution, and I got a completely different result. My terminal said there was a syntax error with the method "split(' ')".

@rdavid1099
Copy link
Author

I have been working through the final section of the Launch Ruby Book and working on fully grasping reading and writing files through ruby (RubyIO). In order to better understand the concept, I challenged myself to create a program that randomly generates PINs for users and saves those PINs into a CSV. The program, then creates an individual CSV for each user - referring to the file using the PIN. In those CSVs, a user can store several pieces of data. Below are photos of the coding and the program in action. I will begin on the CodeSchool stuff tomorrow.
screen shot 2016-06-14 at 10 50 56 am
screen shot 2016-06-14 at 10 50 44 am
screen shot 2016-06-14 at 10 50 31 am
screen shot 2016-06-14 at 10 50 17 am
screen shot 2016-06-14 at 10 49 59 am
screen shot 2016-06-14 at 10 49 45 am
screen shot 2016-06-14 at 10 49 33 am
screen shot 2016-06-14 at 10 49 11 am
screen shot 2016-06-14 at 10 48 58 am
screen shot 2016-06-14 at 10 48 47 am
screen shot 2016-06-14 at 10 48 25 am

@rdavid1099
Copy link
Author

screen shot 2016-06-14 at 10 55 25 am

screen shot 2016-06-14 at 10 55 15 am

screen shot 2016-06-14 at 10 54 02 am

screen shot 2016-06-14 at 10 53 49 am

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