Skip to content

Instantly share code, notes, and snippets.

@ybinstock
Forked from tlicata/PreworkQuiz.md
Last active August 29, 2015 14:07
Show Gist options
  • Save ybinstock/e1ccc8e6d77c6610a257 to your computer and use it in GitHub Desktop.
Save ybinstock/e1ccc8e6d77c6610a257 to your computer and use it in GitHub Desktop.

##Command Line Basics

What are the terminal commands to:

  • Create a new folder called "Blah"
mkdir Blah
  • Move into the newly created "Blah" folder
git init 

*cd Blah
  • Create a "hello.rb" file
mkdir hello.rb
*touch hello.rb
  • Open the "hello.rb" file in Sublime Text
subl "hello.rb"
  • Move back one directory
..


##HTML and CSS

  • Without looking it up, create the basic HTML template structure with Doctype, head, title, and body
<!doctype html> 

<head>
<title> </title>
</head>
<body>
</body>

</html>
  • Write the HTML to add a link to google.com
<a href = "http://www.google.com"> Google Link </a>
  • Link to an external sheet at the path "css/styles.css"
<head>
<link rel = "stylesheet" href = "/css/style.css"
</head>

  • Why do we want to use external stylesheets and scripts instead of adding them directly into our HTML file?
Easier to make edits to the entire HTML sheet from an external doc. Easier to review. 
Seperation of concerns

  • What's the difference between a class and an ID? Why do we use them?
ID is referenced by # and class is refernced by a .

We use them in CSS to make multiple changes in HTML with minimal code. 

ID is used once (#)
Classes can be used more than once. used for a group of elements. (.)

Using the following HTML:

<h1>Hello Guys!</h1>
<p>Don't Mess This Quiz Up!!!</p>
<div>
  <p>I'm a paragraph!</p>
  <p class="lol">I have a class!</p>
  <p id="wdi">I have an ID!</p>
</div>
  • Write CSS to change the color of the <h1>
h1 {
color: red;
}

  • Write CSS to give the <p> with the id of 'wdi' a different font size
#wdi {
font-size: 12
}

  • Write CSS to give the <p> with the class of 'lol' a background color.
.lol {
background-color: red
}
  • Write CSS to give the first <p> in the <div> a yellow border.
div > pL first-child {
border: 5px solid yellow;
}
 div p:nth-child(1) {
 }
 
  • Name at least two of the different color formats used in CSS
RGB 
hex
RGBa
hsl


##Ruby

  • What are the different data types in Ruby?
booleans, numbers, integers, strings, symbols, arrays/hashes

  • How do you print something to the terminal in Ruby?
puts

  • What is an array?
collection of data, storying many types

  • Create an array with 5 of your favorite foods
favorite foods = [apples, bannanas, croissants, prime rib, mashed potatoes]
  • Write code to print out the numbers from 1 to 250
250.times {|x| puts x}
1.upto(250) {|x| puts x}

count = 1
while (count <=250) do
puts count 
count += 1
end


#Javascript

  • Aside from syntax, how is Javascript different from Ruby?
Javascript is primarly used for front end, while Ruby is meant for back 
  • How do you print something to the console in Javascript?
console.log

  • Using a for loop, write code to print out all the odd numbers between 1 and 100. You will also need to use an if statement.
for (var i=0, i<100, i++)
if i%2 !== 0; {
console.log (i)
}


##Git

  • What is Git? What is Github?
Git is a local version control system to back up your files and review past iterations. Github is a global version control to do the same while being able to upload your files to the cloud and share them with others. 
  • What is the command to create an empty git repository in terminal?
git init

  • What is the difference between git add and git commit?
Git add makes the file ready and selected, while git commit adds it to git hub. 

##Optional Bonus

If you finish early, work on this problem:

Using either Ruby or Javascript, write code that will test if a given string is a palindrome. A palindrome is a word that is the same forwards and backwards, like 'mom' or 'racecar' or 'aibohphobia'. You are not allowed to use the built in reverse method or any similar methods.

var = taco
if (taco.reverse = taco ) { 

console.log true}

else {console.log false}


var word = "pizza"
var arr = word.split("");
var copy = [];
for (var i=0, i < arr.length; i++) {

copy.unshift(arr[i]);
}
var one = arr.join("");
var two = copy.join("");
var isPalindrome = one == two;
console.log("one", one);
console.log("two", two);
console.log("isPalindrome", isPalindrome);

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