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
| player_score = 0 | |
| computer_score = 0 | |
| player_reroll = true | |
| while player_score < 100 && computer_score < 100 | |
| while player_reroll == true | |
| puts 'Type roll to roll: ' | |
| to_roll = gets.chomp | |
| while to_roll != 'roll' |
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
| card_names = ['ace', 'two', 'three', 'four', 'five', | |
| 'six', 'seven', 'eight', 'nine', 'ten', | |
| 'jack', 'queen', 'king'] | |
| card_names = [*(card_names.map { |e| "#{e} of hearts" }), | |
| *(card_names.map { |e| "#{e} of diamonds" }), | |
| *(card_names.map { |e| "#{e} of spades" }), | |
| *(card_names.map { |e| "#{e} of clubs" })] | |
| card_values = [*(1..13)] * 4 |
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
| words = ['banana', 'computer', 'rocks', 'giraffe', 'science'] | |
| answer = '' | |
| while answer != 'no' | |
| #init try_count to 6 == number of body parts for hangman | |
| try_count = 6 | |
| random = rand(words.count) | |
| game_word = words[random] | |
| game_word = game_word.split(//) | |
| guessed_word = ['-'] * game_word.count |
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
| computer_dice = [] | |
| player_dice = [] | |
| count = 0 | |
| die_count = 0 | |
| match_count = 0 | |
| computer_matches = [] | |
| player_matches = [] | |
| while count < 5 | |
| throw = rand(6) |
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
| q1 = 'When there is a need to correct someone, I am: | |
| A: afraid to hurt their feelings. | |
| B: quick to do it.' #A = feeling, B = thinking | |
| q2 = 'I consider myself to be: | |
| A: a realist. | |
| B: an idealist.' #A = sensing, B = intuition | |
| q3 = 'Clutter in my home: | |
| A: bothers me. | |
| B: is not something I notice.' #A = judging, B = perceiving | |
| #q4 = 'i tend to: |
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 'sinatra' | |
| get '/serp_checker' do | |
| "<form action='/ranked' method='post'> | |
| <label for='keyword'>Keyword</label> | |
| <textarea name='keyword' id='keyword' type='text' /></textarea> | |
| <label for='url'>URL</label> | |
| <input name='url' id='url' type='text' /> | |
| <input type='submit' value='Go!' /> | |
| </form>" |
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
| puts "Please enter a keyword to go with your 50 states" | |
| keyword = gets.chomp | |
| puts "Would you like your keyword to go before (b) or after(a) your state?" | |
| answer = gets.chomp | |
| states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", | |
| "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", | |
| "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", | |
| "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", | |
| "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", |
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 'sinatra' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| get '/serp_checker' do | |
| "<form action='/ranked' method='post'> | |
| <label for='keyword'>Keyword</label> | |
| <textarea name='keyword' id='keyword' type='text' /></textarea> | |
| <label for='url'>URL</label> | |
| <input name='url' id='url' type='text' /> |
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 'nokogiri' | |
| require 'open-uri' | |
| def get_posts(url) | |
| posts = [] | |
| doc = Nokogiri::HTML(open(url)) | |
| doc.css('link[rel=alternate]').each do |e| | |
| posts << e['href'] | |
| end | |
| posts = posts.drop(1) |
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
| #!/usr/bin/perl | |
| use strict; | |
| use warnings; | |
| my $books = <<'END_OF_REPORT'; | |
| 1 The Well-Grounded Rubyist | |
| 2 Pragmatic Thinking & Learning | |
| 3 Programming Ruby 1.9 | |
| 4 Learning Perl | |
| END_OF_REPORT |