Skip to content

Instantly share code, notes, and snippets.

View klustig88's full-sized avatar

Kevin Lustig klustig88

View GitHub Profile
class Company
attr_accessor :company_name
attr_reader :employees
def initialize(name)
@company_name = name
@employees = []
end
class Person
def self.example_class_method
puts "We're calling an example class method"
puts "'self' is always defined. What is 'self' here? Let's see."
p self
puts "That was self!"
end
def example_instance_method
puts "We're calling an example *instance* method"
# Solution for Challenge: Ruby Drill: Exploring Scope. Started 2013-08-12T19:15:43+00:00
local_var = 2
THIS_IS_A_CONSTANT = 600
$global_var = 500
# def get_local_var
# local_var
# Solution for Challenge: Design Drill: Public vs. Private Interfaces. Started 2013-08-12T16:17:53+00:00
class BankAccount
attr_reader :customer_name, :type, :acct_number
attr_writer :customer_name
def initialize (customer_name, type, acct_number)
@customer_name = customer_name
@type = type
# This is how you define your own custom exception classes
class NoOrangesError < StandardError
end
class OrangeTree
attr_reader :height, :age
def initialize (height, age)
@height = height
@age = age
@klustig88
klustig88 / flashcards.rb
Created August 16, 2013 22:11
Flash Card Game Core from Week 2
class Question
attr_reader :question, :answer
def initialize(args)
@question = args[0]
@answer = args[1]
end
def to_s
"#{question} - #{answer}"

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.
@klustig88
klustig88 / index.html
Created September 24, 2013 20:54 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>