The assignments listed here should take you approximately 2 hours.
To start this assignment, click the button in the upper right-hand corner that says Fork. This is now your copy of the document. Click the Edit button when you're ready to start adding your answers. To save your work, click the green button in the bottom right-hand corner. You can always come back and re-edit your gist.
Documentation of a langauge, framework, or tool is the information that describes its functionality. For this part of the practice tasks, you're going to practice digging into documentation and other reference material.
NOTE: The linked documentation for each question below is a good starting place, but you should also be practicing your Googling skills and sifting through the results to find relevant and helpful sites.
-
In your own words, what does the Ruby array drop method do? As you're explaining, be sure to provide an example. Your answer : Allows removal of certain elements from an array. DATA_POINTS.drop_while {|element| element[:value].nil?} => [ { date: '2016-03-01', value: 100 }, { date: '2016-04-01', value: nil }, { date: '2016-05-01', value: 300 }, { date: '2016-06-01', value: nil }, { date: '2016-07-01', value: nil } ]
-
What did you Google to help you with this task, and how did you pick your results? "Ruby drop array" I read the description and went with one that "explored ways of dropping arrays"
-
In your own words, what does the Ruby array push method do? As you're explaining, be sure to provide an example. Your answer: It inserts an element into an array. sample.push("second item")
-
What did you Google to help you with this task, and how did you pick your results? What does push do in Ruby, I went with the one that was on a study guide site.
-
In your own words, what does the Ruby string split method do? As you're explaining, be sure to provide an example. Your answer: It cuts up a string into predefined strings into an array of smaller strings. require 'pp'
words_str = 'Dog,Cat,Pig' words_arr = words_str.split(',') pp words_arr # ["Dog", "Cat", "Pig"]
-
What did you Google to help you with this task, and how did you pick your results? What does split method do in Ruby, I went with a Ruby study guide
-
In your own words, what does the JavaScript array slice method do? As you're explaining, be sure to provide an example. Your answer: Copies a part of an array and makes a new array with the information without changing the original array. var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.splice(2, 0, "Lemon", "Kiwi");
-
What did you Google to help you with this task, and how did you pick your results? Javascript splice, I went with the one with the description that was about "understanding correctly"
-
In your own words, what does the JavaScript object values method do? As you're explaining, be sure to provide an example. Your answer: creates an array that contains the object's own enumerable property values in the same order, in a loop
const object1 = {
a: 'Edward',
b: 0,
c:false
};
console.log(Object.values(object1));
- What did you Google to help you with this task, and how did you pick your results? javascript "object values method" I went through a few but focused on ones with examples.
Imagine that you're taking your favorite board game and turning it into a computer-based game.
-
Name of board game: Connect 4
-
Use the space below to categorize game data into each of the following data types. You should have a minimum of two pieces of data for each category.
- String data: Red or Black chip
- Integer and/or float data: 5 Spaces up and 5 Spaces across
- Boolean data: Is the space availble, is it playable
- Array data: Saving the Black chip board placement and saving the red chip board placement
- Hash or Object data: Saving the game board to return to, saving the game board for remote play between two players
-
On a blank sheet of paper, create a diagram that shows how you understand iteration working. Be detailed and get creative! When you're done, take a photo of your diagram and post it in the Mod 0 channel on Slack. Your instructor(s) will provide feedback in a thread. (If you're feeling extra fancy, feel free to create your diagram using software instead of pencil and paper)
-
Create a list below of three real-life situations where iteration is used. For each situation, explain why it would be an example of iteration.
-
Product improvement, improving a recipe or improving something like an iphone with feed back from consumers
-
Making food, making a recipe to completion and plating it.
-
Building a deck, following a set of steps will result in a built deck.
-
Create a list below of three programming situations where iteration would be used. For each situation, explain why it would be an example of iteration.
-
Code breaking, applying differnt integers in a sequence till the code is broken
-
Refreshing a webpage to display content till a button is pressed, a moving screen on a game
-
Retrieving specific information from a database, searching for names that match a search query through out a data base
- Watch this video and follow each step to modify your own bash profile. As mentioned in the video, you will need this snippet below:
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}
export PS1="\u\w\`parse_git_branch\`$ "
If you have any questions, comments, or confusions from the any of the readings that you would an instructor to address, list them below:
Please add a little more info to your iteration examples. What collections are being iterated over?