##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
touch hello.rb
- Open the "hello.rb" file in Sublime Text
subl 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>This is the title</title>
</head>
<body>
</body>
</html>
- Write the HTML to add a link to google.com
<a href="http://google.com">Google</a>
- Link to an external sheet at the path "css/styles.css"
<head>
<link src="css/styles.css" type="text/css" rel="stylesheet"/>
</head>
- Why do we want to use external stylesheets and scripts instead of adding them directly into our HTML file?
To create resuable and modular styles that can be referenced by including the stylesheet in your header
- What's the difference between a class and an ID? Why do we use them?
Classes can be resued infinitate amount of times on a single page. Generally used for applying styles. IDs can be used once per page. Generall used to assign styles or scripts to a single element.
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: #333;
}
- Write CSS to give the
<p>
with the id of 'wdi' a different font size
p#wdi{
font-size: 16px;
}
#wdi{
font-size: 92px;
}
- Write CSS to give the
<p>
with the class of 'lol' a background color.
#lol{
background: #ccc;
}
- Write CSS to give the first
<p>
in the<div>
a yellow border.
div p:first-of-type{
border: 1px solid yellow;
}
- Name at least two of the different color formats used in CSS
Hex and RGBA
##Ruby
- What are the different data types in Ruby?
boolean, numbers (integers/floats/fixnum), strings, symbols, arrays/hashes
- How do you print something to the terminal in Ruby?
puts
- What is an array?
A list of variables that can be used by a script.
Sequentially/Indexed
A collection of data, storing many types
- Create an array with 5 of your favorite foods
favfood = ["Pizza", "Sushi", "Hamburgers", "Hamburgers", "Hamburgers"]
- Write code to print out the numbers from 1 to 250
var number = 0;
while (number < 250) {
console.log(number);
number = number + 1;
}
ruby:
250.times {|x| puts x}
2.upto (250) {|x| puts x}
count = 1
while (count <= 250) do
puts count
count += 1
end
for i 1..250
puts i
#Javascript
- Aside from syntax, how is Javascript different from Ruby?
Ruby is compiled and executed on the backend while javascript is executed when the browser renders a page (except when building with node.js)
- How do you print something to the console in Javascript?
console.log ("Foo")
- 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);
}
}
for (num <=99){
if(num%2 !=== 0){
console.log(num)
number = number + 1
}
}
##Git
- What is Git? What is Github?
Git is a version control system. Where Github is a website for hosting your git repos in the cloud
- 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 a file to a temp commit while you continue making changes. Git commit would create a marker or milestone for code changes once pushed to the origin repo.
##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 word = "racecar";
var arr = word.split("");
var copy = [];
console.log(arr);
for (var i = 0; i > arr.length; i++){
copy.unshift(arr[i])
}
var one = arr.join(""):
var two = copy.join("");
var isPal = one == two;
console.log(isPal);