Skip to content

Instantly share code, notes, and snippets.

@Dgrady3
Dgrady3 / guess_the_number.js
Last active August 29, 2015 14:06
Radom guessing game in js
rando = Math.floor((Math.random()*100) +1);
var name = prompt("Hello human, what is your name?");
var guess = prompt("Hello " + name + "! We are going to play the guessing game, guess a number!!" )
if (guess == rando) {
alert("Wowzers, you're good!")
}
else{
alert("Sucks to suck :/")
}
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
end
class DryEraseMarker
attr_reader :color, :capacity
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def clear_board
@clear_board = contents.clear
end
class Card
def initialize(rank, suit)
@suit = suit
@rank = rank
end
def suit
@suit
end
@Dgrady3
Dgrady3 / getters.rb
Created August 29, 2014 17:12
making getters
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
@Dgrady3
Dgrady3 / random_classes.rb
Created August 29, 2014 15:30
Practicing more classes
class Television
def initialize(tv)
@tv = tv
puts "Dang, look at joe's #{@tv}, that's sooo nice"
end
end
Television.new('apple tv')
@Dgrady3
Dgrady3 / random_card_test.rb
Created August 29, 2014 14:58
Random card test
class Card
def initialize(rank = nil, suit = nil)
if rank.nil?
@rank = ['A','2','3','4','5','6','7','8','9','10'].sample
else
@rank = rank
end
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@Dgrady3
Dgrady3 / Pull_challenge.
Created August 26, 2014 18:47
sql challenge
1.) What are the top 50 worst rated movies? The results should include the movie title and rating and be sorted by the worst rating first.
1.) SELECT title, rating FROM movies ORDER BY rating LIMIT 50;
2.) What movies do not have a rating? The results should include just the movie titles in sorted order.
2.) SELECT title, rating FROM movies WHERE rating IS NULL ORDER BY title;
3.) What movies have the word "thrilling" in their synopsis? The results should just include the movie title.
@Dgrady3
Dgrady3 / index.html
Created August 19, 2014 03:21
wana-be haker site
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Slacker News</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
@Dgrady3
Dgrady3 / cashier3.rb
Created August 18, 2014 14:30
more complex version of cashier 1 and 2
require 'csv'
require 'pry'
arr = []
CSV.foreach('products.csv', headers: true) do |row|
arr << {sku: row["SKU"],
name: row["name"],
wholesale: row["wholesale_price"],
retail_price: row["retail_price"],