Skip to content

Instantly share code, notes, and snippets.

View matt297's full-sized avatar

Matt Hennessy matt297

View GitHub Profile

Keybase proof

I hereby claim:

  • I am matt297 on github.
  • I am matt297 (https://keybase.io/matt297) on keybase.
  • I have a public key ASCDHJ1O5CLDjlJPde7o-7t6OuOczDdE-_fpXCU-CToefgo

To claim this, I am signing this object:

@matt297
matt297 / shopping_cart_example.md
Last active June 7, 2017 23:08
Lighthouse Labs - Intro to Web Dev - W4D2 - May 2017 Cohort

app/views/cart_view.erb

<%= erb(:cart_item, locals: { number: 1 }) %>
<%= erb(:cart_item, locals: { number: 2 }) %>
<%= erb(:cart_item, locals: { number: 3 }) %>

app/views/cart_item.erb

@matt297
matt297 / sinatra_form_example.md
Last active June 7, 2017 23:08
Lighthouse Labs - Intro to Web Dev - W4D2 - May 2017 Cohort

app/models/user.erb

class User < ActiveRecord::Base

  # All of the fields listed here are required
  validates_presence_of :email, :avatar_url, :username, :password

  # All of these fields must be unique (i.e. can't register the same email twice)
  validates_uniqueness_of :email, :username
  
@matt297
matt297 / yellowpager_class_solution.rb
Created May 30, 2017 01:56
Lighthouse Labs - Intro to Web Dev - W4D1 - May 2017 Cohort
user_input = "TESTPHONEN"
if user_input.length == 10
user_input.each_char do |letter|
case letter
when("A".."C") then print "2"
when("D".."F") then print "3"
when("G".."I") then print "4"
when("J".."L") then print "5"
when("M".."O") then print "6"
@matt297
matt297 / disk_jockey.rb
Created May 29, 2017 23:43
Lighthouse Labs - Intro to Web Dev - W4D1 - May 2017 Cohort
class DiskJockey
def initialize
@song_history = []
end
def set_song(song, artist)
@song = song
@artist = artist
end
@matt297
matt297 / fizzbuzz_class_solution.rb
Created May 18, 2017 21:43
Lighthouse Labs - Intro to Web Dev - W2D2 - May 2017 Cohort
# The initial solution looked like this:
(1..100).each do |x|
puts x
if x % 3 == 0 && x % 5 == 0
puts "FizzBuzz"
elsif x % 3 == 0
puts "Fizz"
elsif x % 5 == 0
@matt297
matt297 / web_dev_cheatsheet.md
Last active May 1, 2023 05:48
Lighthouse Labs - Intro to Web Dev - Cheat Sheet
@matt297
matt297 / heroku_deployment.md
Last active November 25, 2020 23:56
Lighthouse Labs - Intro to Web Dev - W6D2 - Deploying Finstagram to Heroku

Deploying Finstagram to Heroku

These instructions will help you deploy your Finstagram app to Heroku (a web hosting service), so that the entire internet will be able to see and interact with your application! Before we get to deployment though, we need to make sure a couple of our files are setup properly.

Pre-Deployment: Edit Your Gemfile

Ensure your Gemfile file contains the following code (should match exactly).

source "https://rubygems.org"

gem 'rake'
gem 'activesupport'
@matt297
matt297 / sinatra_form_example.md
Last active June 7, 2017 23:10
Lighthouse Labs - Intro to Web Dev - W4D1 - Oct 2016 Cohort

app/models/user.erb

class User < ActiveRecord::Base

  # All of the fields listed here are required
  validates_presence_of :email, :avatar_url, :username, :password

  # All of these fields must be unique (i.e. can't register the same email twice)
  validates_uniqueness_of :email, :username
  
@matt297
matt297 / calculator_challenge.md
Last active November 15, 2016 01:20
Calculator Challenge

Calculator Challenge

You have been tasked with creating a program that runs in the command line (bash). The program should ask for 2 numbers, a mathematical operator, and then execute the operation on the two numbers.

How It Works

  • Can be run using bash (i.e. ruby yourfile.rb)
  • Asks the user to input a number (i.e. 10)
  • Asks the user to input another number (i.e. 5)
  • Asks the user to input a mathematical operator (i.e. +)
  • Outputs the the result of the computation (i.e. 15.0)