Skip to content

Instantly share code, notes, and snippets.

<script>
function validateForm() {
if((document.getElementById("creditScore_Excellent").checked == false) && (document.getElementById("creditScore_Good").checked == false) && (document.getElementById("creditScore_Poor").checked == false)) {
alert("Please enter a credit score");
return false;
} else {
return true;
}
}
@JDLeigh10
JDLeigh10 / Hangman.rb
Created July 1, 2012 19:51
Hangman game created in Ruby
# Load the dictionary, store it in an array, shuffle it
dictionary = File.open('dictionary.txt')
dictionary_array = dictionary.readlines
dictionary_array.shuffle!
# Intro text, wait for user to type 'start'
puts "\n<<< Terminal Hangman >>>\n\n"
puts "Type \"start\" to begin a new game\n"
turn = 0
rematch = nil
@JDLeigh10
JDLeigh10 / spellcheck.rb
Created June 30, 2012 19:14
Terminal Spell Check
# Load the dictionary, store it in an array
dictionary = File.open('dictionary.txt')
dictionary_array = dictionary.readlines
puts "<<< Terminal Spell Check >>>\n\n"
puts "Type in a word, and see if it is a valid English word\n"
print "> "
user_word = gets.chomp.downcase.strip
# Initialize Variables
deck = []
suits = ["C", "H", "S", "D"]
card_nos = [2,3,4,5,6,7,8,9,10,"J","Q","K","A"]
user_hand = []
@@dealer_hand = []
user_hand_total = 0
valid_input = ['hit', 'stand', 'double', 'split']
# Create a Deck
@JDLeigh10
JDLeigh10 / trivia-game.rb
Created June 30, 2012 05:59
Ruby Trivia Game
# Load the text file, create an array consisting of each line
txt_data = File.open('questions.txt')
txt_data_array = txt_data.readlines
txt_data_array << "FINISHED"
# Initialize variables
questions_array = []
z = []
c = 0
w = 0