Skip to content

Instantly share code, notes, and snippets.

@ryanflach
Forked from mbburch/prework.md
Last active May 8, 2016 22:33
Show Gist options
  • Save ryanflach/171ded269508b9e6f202 to your computer and use it in GitHub Desktop.
Save ryanflach/171ded269508b9e6f202 to your computer and use it in GitHub Desktop.
Gist for Ryan Flach's Turing Prework (#1605)

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:

Task D- Set up your Environment:

  • Did you run into any issues?
    • Yes. I believe they existed due to git and Ruby being installed previously and without the use of Homebrew.
      • When executing brew install git, I received the following error (note: I did not remove the directory it advised):

        • Error: The 'brew link' step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/git Target /usr/local/bin/git already exists. You may want to remove it: rm '/usr/local/bin/git'
          • Fixed with assistance from Matt Pindell.
      • When executing curl -L https://get.rvm.io | bash -s stable, I was given a warning under 'Upgrade Notes:' that stated (note: I did not add the suggested line to the file): WARNING: You have '~/.profile' file, you might want to load it,to do that add the following line to '/Users/Ryan/.bash_profile'

        source ~/.profile

        • Fixed with assistance from Matt Pindell.
  • How do you open Atom from your Terminal?
    • atom
  • What is the file extension for a Ruby file?
    • .rb
  • What is the Atom shortcut for hiding/ showing your file tree view?
    • Command+\
  • What is the Atom shortcut for quickly finding a file (fuzzy finder)?
    • Command+t or Command+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?
    • pwd stands for print working directory and is helpful to determine your current working location in the terminal.
  • What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
    • Your computer's network name. My terminal returns Ryans-MacBook-Air.local.

Task F- Learn Ruby:

Option 1 Questions:

IRB (4/4/16)

  • How do you start and stop irb?
    • In a terminal window, type irb to start irb. To exit irb, type exit.
  • What might you use irb for?
    • To experiment with Ruby and see immediate results.

Variables (4/4/16)

  • How do you create a variable?
    • By using the assignment operator, =. For example, to create a variable named "test" with a value of 3, you would type test = 3.
  • What did you learn about the rules for naming variables?
    • A variable must start with a letter (which should be lowercase), and a multi-work variable should have the words separated by underscores.
  • How do you change the value of a variable?
    • Reassign it using the = sign. From the example above, test could be reassigned by typing test = 4.

Datatypes (4/4/16)

  • How can you find out the class of a variable?
    • By ammending .class to the end of the variable name. To continue from the example above, test.class will give you the class of the variable test.
  • What are two string methods?
    • upcase and reverse
  • How can you change an integer to a string?
    • By calling the method .to_s on the integer.

Strings (4/5/16)

  • Why might you use double quotes instead of single quotes in Ruby?
    • To be able to use characters like ' without needing the mark them with \. Also to enable interpolation within the string using #{}.
  • What is this used for in Ruby: #{}?
    • Interpolation within the string, meaning the execution of valid Ruby statements.
  • How would you remove all the vowels from a string?
    • "This is my test string".delete('aeiou')

Input & Output (4/5/16)

  • What do 'print' and 'puts' do in Ruby?
    • print prints whatever follows the print command to the terminal window without a new line. puts prints out with a new line.
  • What does 'gets' do in Ruby?
    • Waits for entry from the user and returns that entry to 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".
    • Screenshot added and titled "I/O".

Numbers & Arithmetic (4/6/16)

  • What is the difference between integers and floats?
    • Integers are whole numbers only; floats accommodate decimal values.
  • Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
    • Screenshot added and titled "Numbers".

Booleans (4/6/16)

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

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

Conditionals (4/8/16)

  • What is flow control?
    • Using conditionals to have the program make decisions on what to run.
  • 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...
  • What is an infinite loop, and how can you get out of one?
    • A loop that repeats indefinitely due to an exit condition never being met. Get out by using Control + C.
  • Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
    • Screenshot added and titled "Conditionals". Had a problem using .reduce for multiplication (.reduce(:*)) and division (.reduce(:/)). Unable to find a solution online, but I'm sure it's something simple.

nil (4/9/16)

  • What is nil?
    • Nothing. Not zero, not an empty string or array - nothing.
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
    • Screenshot of irb session added and titled "nil".

Symbols (4/9/16)

  • How can symbols be beneficial in Ruby?
    • They are more memory efficient because they point to the same spot in memory, regardless of how many times the symbol is referenced.
  • Does naming symbols use the same rules for naming variables?
    • Not entirely. Symbols differ in that they can start with an uppercase letter or include spaces (so long as quotes are used, single or double).
  • Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".
    • Screenshot of irb session added and titled "Symbols".

Arrays (4/10/16)

  • What method can you call to find out how many elements are in an array?
    • .length or .size
  • What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
    • [0]
  • What do 'push' and 'pop' do?
    • push adds the item(s) to the end of the array; pop(n) removes n number of items from the end of the array and returns them.

Hashes (4/10/16)

  • Describe some differences between arrays and hashes.
    • Arrays store an ordered list of items, while hashes store pairs of items that are associated via keys and values. Values in an array are accessed by their index number, while values in a hash 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?
    • When only one characteristic needs to be stored, e.g., the names of students in a classroom, an array may be most appropriate. When multiple characteristics need to be stored, e.g., the names, ages, and grades of students in a classroom, it would be more efficient to store these related values by using keys in a hash.
  • Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
    • Screenshot of irb session added and titled "Hashes".

Railsbridge Curriculum, cont.

  • Loops: Take a screenshot of your "Challenge" program, and post it as a comment in your Gist.
    • Screenshot added as a comment and titled "Loops Challenge". (4/10/16)
  • What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
    • I did all of them. Screenshot of the first added in the comments and titled "Basics Challenge". (4/10/16)
  • Functions: How do you call a function and store the result in a variable? (4/10/16)
    • After a function has been defined, the result can be stored in a variable in a similar manner to how any other variable is assigned, by using the = operator. For example, if I have a function called epic_example that returns the squared value of a supplied value, I could store that value in a variable named epic_squared by using epic_squared = epic_example(4).
  • Describe the purpose of the following in Ruby classes: (4/11/16)
    • initialize method
      • Saves the initial data the class (object) is created with.
    • new method
      • A means of creating an instance of the class (object). For example, if my class is called TestCase, I would create a new instance of that class with .new.
    • instance variables
      • Allow data to be specific to an instance of the object, without the need for a different variable name in each instance.
  • 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. (4/11/16)
    • Everything was spelled out in the exercise, and I had already completed the Pragmatic Studio Ruby course, so nothing was particularly challenging; however, I did have an "aha" moment: I had previously been under the impression that the values piped in when using .each or .times or any other method that you might use to iterate through an array were always the numbers of the index, and not the values of the index themselves. A simple piece of knowledge, but something I really enjoyed having clarification over.

Launch School Ruby Book

  • screenshots will be posted in comments
    • Screenshots added for all exercises in the comments.
  • What are your three biggest takeaways from working through this book?
    1. With the abundance of documentation available, memorizing syntax is trivial in comparison to knowing how to solve a problem and recognizing what code may be doing in context. Personally, utilizing pseudo code more frequently may help me in developing more thoughtful approaches to solving problems.
    2. Don't reinvent the wheel - many problems have already been solved and may be available in a number of built-in Ruby modules.
    3. Ruby seems to have had a somewhat major revision post version 1.9. It will be important to understand the differences in the language as it continues to evolve.

CodeSchool

  • screenshots will be posted in comments
    • Badge posted as a screenshot in the comments.
  • What are your two biggest takeaways from working through this tutorial?
    1. git will be an incredible tool for version control and collaboration.
    2. I don't learn well from a scratch-the-surface approach, especially when I am not using my own environment to do the exercises (I had similar issues with Codecademy). I feel like I gained an understanding of what git is, but I wouldn't be confident in using it.
  • What is one question you have about Git & GitHub?
    • How to use them together, and what exact configurations need to be done for them to work well together. If I have time prior to the start date I'll likely try to find some more training to answer that question (and upload the program I completed from the Pragmatic Studio Ruby course).

Workflow Video

  • Describe your thinking on effective workflow.
    • Accessibility on your machine that never gets in the way of what you're trying to do, as well as advanced shortcuts that are intuitive and effective, enhancing productivity without the cost of getting lost in something new to memorize.
  • What shortcuts do you think you'll find most useful?
    • Nearly all of them. Command + Ctrl to move methods around more quickly, as well as Command + L to select lines of code. Command + D for finding and modifying multiple instances of a word. Command + Shift + [ to navigate open tabs.
  • What would you like to learn or practice that will most help you improve your speed and workflow?
    • I'm loving Spectacle so far. I'll look forward to getting more comfortable with that. I'd also like to explore additional settings and packages for Atom, as well as getting more comfortable and confident in the terminal.

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?
    • By using the option -n. The entire command would look like this: echo -n hello.
  • 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
    • Ctrl-A: Moves to the beginning of the line.
    • Ctrl-E: Moves to the end of the line.
    • Ctrl-U: Clears to the beginning of the line.
  • 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
    • Ctrl-L to clear; Ctrl-D to exit.
  • 2.1: What is the "cat" command used for? What is the "diff" command used for?
    • cat displays to the shell all content from a file, and it can also combine files when used with arguments.
    • diff compares two files and diplays the difference in the terminal window.
  • 2.2: What command would you use to list all txt files? What command would you use to show all hidden files?
    • ls *.txt to list all txt files.
    • ls -a to list all files, including hidden files.
  • 3.1: How can you download a file from the internet, using the command line?
    • curl -O <URL>, where (including <>) is replaced by the URL.
  • 3.3: Describe two commands you can use in conjunction with "less".
    • /<string> allows you to search for a string within the file. (n and N let you jump forward and backward from results.)
    • G and 1G move to the end and beginning of the file, respectively.
  • 3.4: What are two things you can do with "grep"?
    1. Search for a substring in a file.
    2. Add options such as -n to display the line number in which the search returns a result.

Extend Your Learning

Jumpstart Lab Encryptor Tutorial & Project

I did not use git and GitHub while working on the project, but it has been uploaded:

Ruby on CodeAcademy

Screenshots of badges added in the comments.

  • note: some of the dates appear off, but this is only due to me being in a different time zome when I was completing some of these badges.

Brilliant.org - Additional free logic quizzes

Screenshot of completed quizzes posted in the comments.

Second run of Ruby lessons on typing.io

Screenshots of completed lessons posted in the comments.

Pragmatic Studio Ruby Course

Access to this course was given to me when I was accepted to Turing.

Task G- Prework Reflection:

  • Were you able to get through the work? Did you rush to finish, or take your time?
    • I completed everything except for the Launch School paid course. I was able to get through the first week in a week's time. I rushed through sections of Ruby that I was already familiar with from completing the Pragmatic Studio course, but I still completed all exercises. I took my time on all other work, though I had worked through the Pragmatic Course prior to beginning this pre-work.
  • What are you most looking forward to learning more about?
    • I'm looking forward to getting deeper into languages and learning effective programming practices so that I can write clean, efficient code that is easy for others to understand (and easy for me to understand at a later date) yet complex in its capability. Additionally, I'm looking forward to strengthening my ability to convert a problem to a set of requirements to build effective algorithms.
  • What topics would you most like to see reinforced by instructors?
    • I'll look forward to having more practice in the terminal so that I can become proficient enough that it is more efficient and second nature for me to use than the GUI. Additionally, as my knowledge increases I assume I will be able to better formulate questions to find answers to problems online or through a mentor, and that skillset is something I would like to build on.
  • What is most confusing to you about what you've learned?
    • Properly visualizing the stack that is built in the shell through the 'pushd' and 'popd' commands. I also struggled with some of the arrangement puzzles on Brilliant.org.
  • What questions do you have for your student mentor or for your instructors?
    • No questions at this time - looking forward to starting class!
@ryanflach
Copy link
Author

"Loops Challenge"
screen shot 2016-04-10 at 9 41 58 am
screen shot 2016-04-10 at 9 42 33 am

@ryanflach
Copy link
Author

"Basics Challenge"
screen shot 2016-04-10 at 10 39 55 am

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/11/16:
screen shot 2016-04-11 at 9 23 11 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercise: Preparations
screen shot 2016-04-12 at 4 32 51 pm

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/12/16:
screen shot 2016-04-12 at 4 39 24 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: The Basics
screen shot 2016-04-12 at 9 42 24 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Variables
screen shot 2016-04-13 at 3 59 01 pm
screen shot 2016-04-13 at 3 59 28 pm
screen shot 2016-04-13 at 3 59 46 pm

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/13/16:
screen shot 2016-04-13 at 4 03 40 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Methods
screen shot 2016-04-13 at 4 45 11 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Flow Control
screen shot 2016-04-14 at 5 46 12 pm
screen shot 2016-04-14 at 5 46 37 pm
screen shot 2016-04-14 at 5 46 48 pm

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/14/16:
screen shot 2016-04-14 at 5 50 33 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Loops & Iterators
screen shot 2016-04-15 at 4 52 57 pm

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/15/16:
screen shot 2016-04-15 at 4 56 58 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Arrays
screen shot 2016-04-17 at 10 31 06 am

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/17/16:
screen shot 2016-04-17 at 10 34 39 am

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Hashes
screen shot 2016-04-17 at 2 48 12 pm
screen shot 2016-04-17 at 2 48 26 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Files
note: the final exercise was too long for screenshots, so the last screenshot is just an image of my directory that includes the files created in that exercise.
screen shot 2016-04-17 at 4 10 39 pm
screen shot 2016-04-17 at 4 19 15 pm
screen shot 2016-04-17 at 5 35 49 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: More Stuff
screen shot 2016-04-17 at 6 43 35 pm

@ryanflach
Copy link
Author

Launch School Ruby Exercises: Exercises
screen shot 2016-04-17 at 7 24 14 pm
screen shot 2016-04-17 at 7 24 31 pm
screen shot 2016-04-17 at 7 24 46 pm

@ryanflach
Copy link
Author

Code School Try Git Badge:
screen shot 2016-04-18 at 5 00 09 pm

@ryanflach
Copy link
Author

Task A - Screenshot of typing.io score on 4/18/16:
screen shot 2016-04-18 at 5 11 00 pm

@ryanflach
Copy link
Author

Extend Your Learning - Ruby on CodeAcademy: Badges earned 4/25/16:
screen shot 2016-04-25 at 9 01 06 am

@ryanflach
Copy link
Author

Extend Your Learning - Ruby on CodeAcademy: Badges earned 4/26/16:
screen shot 2016-04-26 at 9 14 51 pm
screen shot 2016-04-26 at 9 15 04 pm

@ryanflach
Copy link
Author

Extend Your Learning - Ruby on CodeAcademy: Badges earned on 4/27/16:
screen shot 2016-04-27 at 8 36 40 pm

@ryanflach
Copy link
Author

Extend Your Learning - Ruby on CodeAcademy: Badges earned on 4/28/16:
screen shot 2016-04-28 at 8 01 18 pm
screen shot 2016-04-28 at 8 01 07 pm

@ryanflach
Copy link
Author

Extend Your Learning - Ruby on CodeAcademy: Badges earned on 4/29/16:
screen shot 2016-04-29 at 7 44 46 pm
screen shot 2016-04-29 at 7 44 54 pm

@ryanflach
Copy link
Author

ryanflach commented May 1, 2016

Extend Your Learning - Ruby on CodeAcademy: Badges earned on 5/1/16:
screen shot 2016-05-01 at 1 13 06 pm
screen shot 2016-05-01 at 1 13 20 pm

@ryanflach
Copy link
Author

Extend Your Learning - Free Logic quizzes on Brilliant.org completed on 5/2/16:
screen shot 2016-05-02 at 8 36 53 am

@ryanflach
Copy link
Author

ryanflach commented May 3, 2016

Extend Your Learning - Second run of Ruby lessons on typing.io: Results on 5/2/16:
screen shot 2016-05-02 at 2 22 12 pm
screen shot 2016-05-02 at 2 33 33 pm
screen shot 2016-05-02 at 2 53 10 pm
screen shot 2016-05-02 at 2 54 33 pm
screen shot 2016-05-02 at 2 57 28 pm
screen shot 2016-05-02 at 3 00 14 pm
screen shot 2016-05-02 at 3 02 22 pm

@ryanflach
Copy link
Author

Extend Your Learning - Second run of Ruby lessons on typing.io: Results on 5/3/16:
screen shot 2016-05-03 at 7 07 42 am
screen shot 2016-05-03 at 7 10 36 am
screen shot 2016-05-03 at 7 13 07 am
screen shot 2016-05-03 at 7 15 58 am
screen shot 2016-05-03 at 7 18 04 am
screen shot 2016-05-03 at 7 19 51 am

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