This file contains 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
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 :/") | |
} |
This file contains 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
class Whiteboard | |
attr_accessor :contents | |
def initialize(contents = []) | |
@contents = contents | |
end | |
end | |
class DryEraseMarker | |
attr_reader :color, :capacity |
This file contains 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
class Whiteboard | |
attr_accessor :contents | |
def initialize(contents = []) | |
@contents = contents | |
end | |
def clear_board | |
@clear_board = contents.clear | |
end |
This file contains 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
class Card | |
def initialize(rank, suit) | |
@suit = suit | |
@rank = rank | |
end | |
def suit | |
@suit | |
end |
This file contains 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
class Car | |
def initialize(color, owner, cylinders) | |
@color = color | |
@owner = owner | |
@cylinders = cylinders | |
end | |
def color | |
@color | |
end |
This file contains 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
class Television | |
def initialize(tv) | |
@tv = tv | |
puts "Dang, look at joe's #{@tv}, that's sooo nice" | |
end | |
end | |
Television.new('apple tv') |
This file contains 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
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 |
This file contains 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
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. |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Slacker News</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> |
This file contains 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 '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"], |
NewerOlder