This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1 | |
Cascading relates to specificity because it means that this rule applies to all selectors that this | |
style specifies. Sometimes, however, an HTML element may be described by more than one CSS selector. | |
In this case, the cascading effect follows a rule of specificity; the most specific stylistic rule is | |
applied while the others are ignored, though will still apply to any element to which they ARE most | |
specific. | |
Question 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A function which returns an array of ints from 0 to 'n', which is provided as a parameter | |
function arrayOfLight(n) { | |
var arr = []; | |
for (var i = 0; i <= n; i++) { | |
arr[i] = i; | |
} | |
return arr; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rspec' | |
gem 'pry' | |
gem 'byebug' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filename: poppin-bottles.rb | |
# Author: michael longauer | |
# | |
# Concept: | |
# - For every two empty bottles, you can get one free (full) bottle of pop | |
# - For every four bottle caps, you can get one free (full) bottle of pop | |
# - Each bottle of pop costs $2 to purchase | |
# - Given these parameters, write a program so that you can figure out how many total | |
# bottles of pop can be redeemed given a customer investment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
# filename: char_counting.rb | |
# author: michael longauer | |
# returns the number of occurrences for each char in a given string | |
def count_letters(string) | |
letters = Hash.new (0) | |
string.split("").each do |letter| | |
letters[letter] += 1 unless letter == " " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Merge sort - for W1D2 Stretch Goal @ Lighthouse Labs! | |
# got help from wikipedia: https://en.wikipedia.org/wiki/Merge_sort | |
def merge_sort(arr) | |
return arr if arr.length == 1 | |
middle = arr.length / 2 | |
left = arr[0..middle-1] | |
right = arr[middle..arr.length-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Concept: | |
# - Signs cost $15 per square foot. | |
# - If a sign has two colours or fewer, add $10 for each colour. | |
# - If a sign has more than two colours, add $15 for each colour. | |
# - Tax is 15%. | |
# - The boss insists that he just wants one function that he can put the dimensions | |
# and colour count in, and get the total back. | |
@tax = 0.15 |