Skip to content

Instantly share code, notes, and snippets.

Now that you have learned the basics of Git workflow, try running through this a couple of times on your own:
Create a folder called learn_git_again. mkdir learn_git_again
cd into the learn_git_again folder.cd learn_git_again
Create a file called third.txt. touch third.txt
Initialize an empty git repository. git init
Add third.txt to the staging area.git add third.txt
Commit with the message "adding third.txt".git commit -m "adding third.txt"
Check out your commit with git log.git log
Create another file called fourth.txt.touch fourth.txt
Now that you have learned the basics of Git workflow, try running through this a couple of times on your own:
Create a folder called learn_git_again. mkdir learn_git_again
cd into the learn_git_again folder.cd learn_git_again
Create a file called third.txt. touch third.txt
Initialize an empty git repository. git init
Add third.txt to the staging area.git add third.txt
Commit with the message "adding third.txt".git commit -m "adding third.txt"
Check out your commit with git log.git log
Create another file called fourth.txt.touch fourth.txt
@Vinge1718
Vinge1718 / gist:d3aaba4a81d72a9bc26d054162406ff8
Created July 6, 2021 04:53
Git Basics Exercise - Answers
Now that you have learned the basics of Git workflow, try running through this a couple of times on your own:
Create a folder called learn_git_again. mkdir learn_git_again
cd into the learn_git_again folder.cd learn_git_again
Create a file called third.txt. touch third.txt
Initialize an empty git repository. git init
Add third.txt to the staging area.git add third.txt
Commit with the message "adding third.txt".git commit -m "adding third.txt"
Check out your commit with git log.git log
Create another file called fourth.txt.touch fourth.txt
function binarySearch(numberArray, key){
var firstIndex = 0;
var lastIndex = numberArray.length - 1;
while (firstIndex <= lastIndex){
// Find the mid index
var middleIndex = Math.floor((firstIndex + lastIndex) / 2);
var middleElement = numberArray[middleIndex];
// Pseudocode
- As always we'll start by defining our function which takes an array as a parameter - as reviewed in the logic above: function bubbleSort(array){};
- Model the parent loop to iterate upto n-1 limits
- Model the inner loop to deduct each pass from the already set limit of the parent loop
- As we loop through the array we are going to be comparing and switching our array elements - when necessary, that is, until our largest number bubbles up to the top/end.
- With the two loops in place, we now need to build out the code to compare and switch neighbouring numbers - if necessary.
// Code