This file contains hidden or 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
| score= [75, 100, 85, 65, 84, 87, 95] | |
| min_local = 100000000 | |
| max_local = 0 | |
| total= 0 | |
| score.inject(0) do |sum, test| | |
| if test > max_local | |
| max_local = test |
This file contains hidden or 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' | |
| require 'date' | |
| @finish_num = nil | |
| @report_num = nil | |
| def load_the_db(check = 0) | |
| order_list = CSV.table('products.csv') |
This file contains hidden or 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
| def number_details(number) | |
| #returns: Jenny has the number 508.867.5309 and it is their home number | |
| phone_numbers_2 = { | |
| 'Dan' => { | |
| home: '508.555.5555', | |
| mobile: '508.555.6666' | |
| }, | |
| 'Jenny' => { | |
| home: '508.867.5309', |
This file contains hidden or 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
| module BinaryTree | |
| class Node | |
| attr_reader :word, :count, :left, :right | |
| include Enumerable | |
| def initialize(word) | |
| @word, @count = word, 1 | |
| end |
This file contains hidden or 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(channel=3,show="24") | |
| @channel = channel | |
| @show = show | |
| end | |
| end |
This file contains hidden or 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 hidden or 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
| def clear! | |
| @contents =[] | |
| end |
This file contains hidden or 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
| def ink_remaining? | |
| @capacity > 0 | |
| end |
This file contains hidden or 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
| #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. | |
| SELECT title, rating FROM movies ORDER BY rating LIMIT 50; | |
| # What movies do not have a rating? The results should include just the movie titles in sorted order. | |
| SELECT title FROM movies WHERE rating IS NULL; |
This file contains hidden or 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
| createdb recipes | |
| CREATE TABLE recipes ( | |
| id SERIAL NOT NULL , | |
| name VARCHAR(125) NOT NULL , | |
| yields VARCHAR(50), | |
| total_time VARCHAR(150), | |
| directions TEXT NOT NULL | |
| ); |