##Command Line Basics
What are the terminal commands to:
- Create a new folder called "Blah"
mkdir Blah
- Move into the newly created "Blah" folder
cd Blah
- Create a "hello.rb" file
?
- Open the "hello.rb" file in Sublime Text
subl open hello.rb
- Move back one directory
cd ..
##HTML and CSS
- Without looking it up, create the basic HTML template structure with
Doctype
,head
,title
, andbody
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p></p>
</body>
</html>
- Write the HTML to add a link to google.com
<a href="google.com"></a>
- Link to an external sheet at the path "css/styles.css"
<link type="text/css" rel="styles.css" href="css/styles.css"/>
- Why do we want to use external stylesheets and scripts instead of adding them directly into our HTML file?
To organize our code and make it more legible. Also to reduce redundancy.
- What's the difference between a class and an ID? Why do we use them?
A class is good to dictate the styling of multiple elements and an ID of a single element. #id and .class. We use them to style at a level of greater specificity.
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: 24px;
}
- 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 p {
border: 1px solid yellow;
}
- Name at least two of the different color formats used in CSS
hexadecimal and RGB
##Ruby
- What are the different data types in Ruby?
numbers, strings, booleans, objects, arrays
- How do you print something to the terminal in Ruby?
print or puts
- What is an array?
a group of values with indexed positions in a value chain
- Create an array with 5 of your favorite foods
foods = [spaghetti,steak,potatoes,bernaise,burritos] #I should be healthier...
- Write code to print out the numbers from 1 to 250
250.times do
var i=1
puts i
i += 1
end
#Javascript
- Aside from syntax, how is Javascript different from Ruby?
It is harder... It was derived from java. --- Honestly, not sure on this one.
- How do you print something to the console in Javascript?
console.log("something")
- 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){
} else {
console.log(i);
}
}
##Git
- What is Git? What is Github?
Git is a version control system. Github is a social network that allows for collaboration and public sharing of user's projects / Git repositories.
- What is the command to create an empty git repository in terminal?
git init
- What is the difference between
git add
andgit commit
?
git add - adds your file to the staging area
git commit - commits any changes to the current branch
##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.
.JS:
palindrome = function(word) {
test = word.split
amount = test.length
rev=[]
for(i=amount; i=0; i--){
push.rev[test[i]]
}
if (test === rev) {
console.log("Your word is a palindrome!)
} else {
console.log("try again...")
}
}
word = prompt("Give me a palindrome");
palindrome(word)