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
light = 5 | |
medium = 7.50 | |
bold = 9.75 | |
puts "How much money does the customer owe?" | |
owed = gets.chomp.to_f | |
puts "How much money did the customer give you?" |
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
NUMBER = 673 | |
message = print "Guess a number between 0 and 1000:" | |
guess = gets.chomp.to_i | |
until guess == NUMBER | |
message = "Guess a number between 0 and 1000:" | |
difference = NUMBER - guess | |
if difference >= 0 | |
puts "Too low, try again..." |
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
def sales_price_loop | |
input = nil | |
totals = [] | |
subtotal = 0 | |
until input == "done" | |
puts "What is the sale price?" | |
unless input == "done" | |
input = gets.chomp | |
subtotal = tally(input, totals, subtotal) | |
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
characters = { | |
"Tyrion Lannister" => "House Lannister", | |
"Jon Snow" => "Night's Watch", | |
"Hodor" => "House Stark", | |
"Stannis Baratheon" => "House Baratheon", | |
"Theon Greyjoy" => "House Greyjoy" | |
} | |
characters.each do |key,value| | |
puts key + " represents the " + value |
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
commit 1b60a793e9a74abba5eda41a265c58f011c661b5 | |
Author: ewhitebloom <ewhitebloom@gmail.com> | |
Date: Thu Feb 20 19:48:55 2014 -0500 | |
Even more items added | |
commit 191736b523c0cc14a191a5acc5fae586952d4a74 | |
Author: ewhitebloom <ewhitebloom@gmail.com> | |
Date: Thu Feb 20 19:47:32 2014 -0500 |
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
nums = [75, 100, 85, 65, 84, 87, 95] | |
def average(nums) | |
sum = 0 | |
nums.each do |number| | |
sum += number | |
end | |
sum/nums.length | |
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
1) select title, rating from movies where rating is not null order by rating asc limit 50; | |
2) select title from movies where rating is null order by title asc; | |
3) select title from movies where synopsis ilike '%thrilling%'; | |
4) select title, year, rating from movies join genres on movies.genre_id = genres.id where genres.name = 'Science Fiction & Fantasy' AND movies.year BETWEEN 1980 AND 1990 order by rating desc; | |
5) select actors.name, movies.title, movies.year from cast_members join actors on actors.id = cast_members.actor_id join movies on movies.id = cast_members.movie_id where character ilike '%james bond%' order by year desc; |
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
package edu.hu.bigdata; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.util.*; | |
import org.bson.Document; | |
import org.bson.json.JsonParseException; | |
import com.mongodb.MongoClient; |
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
package main | |
import ( | |
"bufio" | |
"database/sql" | |
"fmt" | |
_ "github.com/go-sql-driver/mysql" | |
"os" | |
"reflect" | |
"strconv" |
OlderNewer