Skip to content

Instantly share code, notes, and snippets.

View grrilla's full-sized avatar
💭
I should update this picture.

Michael Longauer grrilla

💭
I should update this picture.
  • Searchspring
  • Toronto, Ontario, Canada
View GitHub Profile
@grrilla
grrilla / sign_shop.rb
Last active July 19, 2016 21:27
Program used for a sign shop owner to calculate the pricing for his or her signs.
# 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
@grrilla
grrilla / merge_sort.rb
Last active July 19, 2016 22:35
Practice writing a sort function in Ruby using the merge sort algorithm.
# 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]
@grrilla
grrilla / char_counting.rb
Last active July 20, 2016 17:39
Function to count instances of unique, non-whitespace characters in a given string, and returns that data as a hash.
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 == " "
@grrilla
grrilla / poppin-bottles.rb
Last active July 21, 2016 13:03
A 'REPL' interface for customers of a fictional grocery outlet to find out how many bottles of pop they'd receive for n dollars.
# 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.
@grrilla
grrilla / Gemfile
Created July 27, 2016 16:26
Stub practice assignment from W2D3 @ Lighthouse Labs
source 'https://rubygems.org'
gem 'rspec'
gem 'pry'
gem 'byebug'
@grrilla
grrilla / array_of_light.js
Created August 22, 2016 17:10
A Ray of Light - JS Exercise
// 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;
}
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