- screenshots of scores posted in comments
- screenshots of completed sections posted in comments
- Did you run into any issues?
- Significant issues with Xcode install. ~6 hours total. First install took ~3 hours, but didn't work. Still said I had version 7.1.1 (seems like this is a common issue: https://forums.developer.apple.com/thread/28065). Had to delete and reinstall. Second install took another 3 hours. But worked.
- Other issues related (I think) to previous use of Fish as shell. Caused a number of warnings on RVM and homebrew updates (I had previous installs on both of these as well). I couldn't resolve these on my own (got help from a friend).
- How do you open Atom from your Terminal?
- Type 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
- screenshots of your terminal after each exercise posted in comments
Day One Questions:
- What does pwd stand for, and how is this command helpful?
- Print Working Directory. Helps you figure out where you are.
- What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
- Name of the computer the terminal is logged in to. Mine is: Kerrys-Air
IRB
- How do you start and stop irb?
- start: irb in command line
- stop: exit
- What might you use irb for?
- to get a quick glance of how a statement might evaluate, etc
- to find available methods for a class, etc.
Variables
- How do you create a variable?
- variable_name = assigned_value
- What did you learn about the rules for naming variables?
- can't start with number (but can have a number in middle/end)
- can't be all numbers
- can have underscore but not dash
- How do you change the value of a variable?
- reassign the variable name to a new value
Datatypes
- How can you find out the class of a variable?
- variable_name.class
- What are two string methods?
- upcase, reverse, delete, length
- How can you change an integer to a string?
- call .to_s on the integer
Strings
- Why might you use double quotes instead of single quotes in Ruby?
- so you don't have to escape an ' in the string
- so you can do string interpolation using #{}
- What is this used for in Ruby: #{}?
- string interpolation - can put a variable name or other expression in there and it gets inserted as text as part of string output
- How would you remove all the vowels from a string?
- sample_string.delete('aeiou')
Input & Output
- What do 'print' and 'puts' do in Ruby?
- both evalute to nil
- puts "prints" the string to the console and adds new line after
- prints "prints" the string to the consoloe but does not add new line
- What does 'gets' do in Ruby?
- takes in user input as a string
- Screenshot in comments of the program created that uses 'puts' and 'gets',with title, "I/O".
Numbers & Arithmetic
- What is the difference between integers and floats?
- integers have no decimal places, floats do
- Screenshot of program in the comments with the title, "Numbers".
Booleans
- What do each of the following symbols mean?
- == EQUAL
-
= GREATER THAN OR EQUAL
- <= LESS THAN OR EQUAL
- != NOT EQUAL
- && AND
- || OR
- What are two Ruby methods that return booleans?
- nil?, include?
Conditionals
- What is flow control?
- when the program decides which path to take based on evaluating an expression (e.g. if/else)
- What will the following code return?
- I think it returns nil, but it would 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?
- a loop that has no exit and runs infinitely (i.e. a while loop where you never get a chance to make the expression false).
- to get out, Control + c
- Screenshot of program and terminal showing two different outputs in the comments with the title, "Conditionals".
nil
- What is nil?
- empty or null (no value assigned)
- Screenshot of terminal after working through Step 4, in the comments with the title, "nil".
Symbols
- How can symbols be beneficial in Ruby?
- they take up less memory than a string, etc. more efficient.
- you use them when the content is not important
- Does naming symbols use the same rules for naming variables?
- from what I could tell, yes.
- Screenshot of your terminal after working through Step 4, posted in 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 item to the end of the array
- pop removes an item from the end of the array. I think it can take an argument that would tell it how many to remove
- mutates original array
Hashes
- Describe some differences between arrays and hashes.
- arrays are ordered lists. items are in a fixed/indexed position
- hashes are not ordered. they are for key/value pairs.
- What is a case when you might prefer an array? What is a case when you might prefer a hash?
- you would prefer an array when order matters or when there is just a list of things - no need for key/values.
- you would prefer a hash when you need to associate a value with a key. you could almost create an object with a hash - a set of properties with an associated set of values for that item.
-
- Screenshot of terminal after working through Step 2, posted in comments with the title, "Hashes".
- Loops: Screenshot of "Challenge" program posted as a comment
- What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
- Verifying voting age based on user input (screenshot in comments)
- creating a Hash of name/favorite color pairs
- Functions: How do you call a function and store the result in a variable?
- variable = function(arguments)
- Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
- inialtize: stores the data that you create your object with
- new method: creates an instance of the class
- instance variables: variables that the class methods need to use; not accessible outside the class.
- 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.
- screenshots will be posted in comments
- I forgot to do screenshots for most of the beginning... Started doing them later.
- What are your three biggest takeaways from working through this book?
- Notes on new things I learned (vs 3 takeaways)
- difference between p and puts was new to me. p displays the value (doesn't call to_s on object) AND returns value, vs nil.
- in ruby, return value is last line executed unless stated explicitly earlier (although this is a bit confusing to me because it also says that nothing after return statement is executed)
- pry as a debugger (although I don't know how to use it as a debugger yet)
- discussion on scope - while not new to me, I don't have an intrinsic grasp on this at all times.
- some methods mutate the object i.e. pop, replace
- recursion is a function that calls itself. while I get this and can do simple ones, I wouldn't instinctively identify opportunities to use recursion. I'd like to spend some time learning to identify opportunities to use that solution.
- difference between next and break and when/why to use next.
- on array methods, important to understand what various methods return and which ones do/do not mutate the orginal array. Difference between map and each on array is interesting. Map returns a new array. Each returns original array (which was not mutated).
- exception class for handling errors. reserve words: begin, rescue, end. Rescue part tells it what to do if an error is thrown. But the code doesn't break at the error; continues to execute
- regex for finding patterns in strings. /pattern/ syntax. can use /pattern/.match(word) or =~
- procs when you need to reuse the same block in your code. assign the block to a new Proc object. need to use the .call method on them
- Notes on new things I learned (vs 3 takeaways)
- screenshots posted in comments
- What are your two biggest takeaways from working through this tutorial?
- no big takeaways; I've used this git functionality before
- one thing that was good clarification for me was difference betwen git diff HEAD, git diff staged and git diff (although the tutorial doesn't really explain it - just tells you to do it. I found this on stack overflow as a good explanation: http://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged)
- What is one question you have about Git & GitHub?
- no questions based on this. based on past experience, this level of understanding is not deep enough for me. I may try to make my own tutorial where I intentionally screw something up and need to revert to old files, etc. otherwise, you end up in a state of continual fear of git, whereas the value of git is that it removes fear.
- 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?
- If "workflow" means using the keyboard shortcuts from the video, here goes (although it seems to me that it's more than this, but I don't really know enough to speak to workflow more generally). For the most part, workflow seems to be focused on avoiding the use of the mouse at all costs. :) This seems valid not just from an efficiency perspective, but also from the perspective of removing distraction and maintaining train of thought.
- Shortcuts I will use:
- Multiple cursors in Atom (Command D until all selected then Right Arrow) is one that I will use. Not only does it save time, it also prevents errors (i.e. missing one instance of the variable name being changed).
- Select lines - Command L (L L L...). to select a block of text to move (control + command + up/down)
- Split panes (for files that interact with eachother, good to have them open)
- Resizing - command + option + down/up
- In general, I'm a bit overwhelmed by the spectacle shortcuts. I think I need to find a chart that puts them in words vs symbols. I have a hard time with symbols. I also think I need to pick a few that I will use and stick to those:
- Command + Option + Right/Left : Resizes to 50% aligned left or right (a second l/r changes to 2/3)
- Command + Option + Up/Down : Resizes to 50% aligned up or down (a second up/down changes to 2/3)
- Command + Option + f: resizes to Full Screen
- Control + Option + Right/Lift: resizes to vertical 1/3s and moves
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?
- echo -n hello
- 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
- ^ A: moves to beginning of command line for editing
- ^ E: moves to end of command line for editing
- ^ U: clears everything in command line up to current position
- ALSO option + mouseclick: moves to selected location in command line
- 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
- clear: clear or ^ L
- exit: exit or ^ D
- 2.1: What is the "cat" command used for? What is the "diff" command used for?
- cat is concatenate - can take multiple (file) arguments. when given one file it prints it in string rep
- diff shows the difference between the two files given as arguments
- 2.2: What command would you use to list all txt files? What command would you use to show all hidden files?
- list all txt files: ls *.txt
- list all files including hidden: ls -a
- 3.1: How can you download a file from the internet, using the command line?
- curl -OL
- 3.3: Describe two commands you can use in conjunction with "less".
- spacebar - page down
- / seach for that term (n to next, N to previous)
- 3.4: What are two things you can do with "grep"?
- you can find things in a file (I'm not sure that there was a second thing discussed. You can find things in many different ways, but I don't know that grep does anything other than find???)
Write a Ruby program to encrypt and decrypt secret messages (get better with Atom & the command line): http://tutorials.jumpstartlab.com/projects/encryptor.html. Contact your student mentor, and ask them to help you use Screenhero to share your work with them. If you’re feeling extra savvy, try using GitHub for version control as you do this tutorial. Spread the work on this out over a few days, and give yourself time for repetition. There are some concepts in here that you’ll use a lot (classes, File I/O, etc.)
- I decided to write my own program vs go through this tutorial (for now!). First, there was a program that I wanted to write that would give me practice in things I am most weak at (and the product of the program will also help me with my prep). And, second, the tutorial looks like it gives a lot of direction and I wanted to work through some stuff on my own.
- So... my program. It produces a list of the most popular/most used ruby methods in a user-provide github repo. I'm using rails repo as a proxy for all ruby code, to identify most popular methods for my learning.
- I'm using git/github for my program to practice version control - branching for all new features. https://github.com/kjs222/pop_ruby_methods
- current status:
- Fully functional - OUTPUT FROM RAILS REPO SHOWN IN COMMENTS
- Needs tests
- 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?
TASK A - DAY 6
![screen shot 2016-02-23 at 8 11 19 am](https://cloud.githubusercontent.com/assets/11400778/13257808/1cfc5c1e-da05-11e5-9fbc-0c496f1eb6b2.png)