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
@csvobjects = [] | |
CSV.foreach('example.csv', headers: true) do |row| | |
@csvobjects << row | |
end | |
result = @csvobjects.select { |k,v| k[:email] == "[email protected]" }.first | |
result[:name] |
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
var secretNumber = Math.random()*100; | |
secretNumber = Math.round(secretNumber); | |
var name = prompt("What's yo name baby?"); | |
for(i = 0; i < 10; i++) { | |
var guess = prompt("Enter your guess, baby!"); | |
if(guess == secretNumber) { |
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(size, channel) | |
@channel = channel | |
@size = size | |
end | |
def change_chan(@channel) | |
puts "Channel changed to #{@channel}." |
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 suit.nil? | |
@suit = ['♠', '♣', '♥', '♦'].sample | |
else | |
@suit = suit | |
end | |
if rank.nil? | |
@rank = ['A','2','3','4','5','6','7','8','9','10','J','Q','K'].sample |
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
favorite_movies = [ | |
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 }, | |
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 }, | |
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 } | |
] | |
favorite_movies.each do |movie| | |
puts "#{movie[:year_released]}: #{movie[:title]}" | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>SWAGGER NEWS</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<div class="wrapper"> |
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
scores = [75, 100, 85, 65, 84, 87, 95] | |
def min(numb_array) | |
sorter = numb_array[0] | |
numb_array.each do |each_num| | |
if each_num.to_f <= sorter | |
sorter = each_num.to_f | |
end | |
end | |
sorter |
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 'pry' | |
#!/usr/bin/env ruby | |
wordbank = ['hundred', 'bozo', 'swag', 'lariat', 'bowler', 'ape', 'master'] | |
display_word = String.new | |
secret_word = String.new | |
guess = String.new | |
chances = 10 |
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 'pry' | |
require 'csv' | |
def calc_subtotal(menu, order) | |
runtotal = 0 | |
order.each do |sku, qty| | |
subtotal_item = menu.find {|item| item["SKU"] == sku} | |
runtotal += subtotal_item["retail_price"] * qty |
NewerOlder