Skip to content

Instantly share code, notes, and snippets.

@aeschright
Last active December 2, 2017 23:21
Show Gist options
  • Select an option

  • Save aeschright/9ec5c7574e53f36cbd3221894e24b3a1 to your computer and use it in GitHub Desktop.

Select an option

Save aeschright/9ec5c7574e53f36cbd3221894e24b3a1 to your computer and use it in GitHub Desktop.

Revisions

  1. aeschright revised this gist Dec 2, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion moods.rb
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@
    end
    end

    File.open('moods.txt', 'w') do |file|
    File.open('moods.txt', 'a') do |file|
    file.puts "#{Time.now} #{emoji}"
    end
    puts "I recorded your answer."
  2. aeschright revised this gist Dec 2, 2017. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions moods.rb
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,9 @@
    mood_description = gets.chomp

    while mood_satisfied == false do
    if mood_description == "happy"
    if ["happy", "delighted", "gratified", "glad", "joyful", "joyous", "pleased", "satisfied", "thankful", "tickled"].include? mood_description
    emoji = happy_emojis.sample
    elsif mood_description == "sad"
    elsif ["sad", "bad", "blue", "brokenhearted", "cast down", "crestfallen", "dejected", "depressed", "despondent", "disconsolate", "doleful", "down", "downcast", "downhearted", "droopy", "forlorn", "gloomy", "glum", "hangdog", "heartbroken", "heartsick", "heartsore", "heavyhearted", "inconsolable", "joyless", "low", "low-spirited", "melancholic", "melancholy", "miserable", "mournful", "saddened", "sorrowful", "sorry", "unhappy", "woebegone", "woeful", "wretched"].include? mood_description
    emoji = sad_emojis.sample
    end

    @@ -25,4 +25,7 @@
    end
    end

    File.open('moods.txt', 'w') do |file|
    file.puts "#{Time.now} #{emoji}"
    end
    puts "I recorded your answer."
  3. aeschright revised this gist Dec 2, 2017. 1 changed file with 28 additions and 1 deletion.
    29 changes: 28 additions & 1 deletion moods.rb
    Original file line number Diff line number Diff line change
    @@ -1 +1,28 @@
    #!/usr/local/env ruby
    #!/usr/bin/env ruby

    happy_emojis = ["πŸ˜€", "πŸ˜ƒ", "😺", "😸"]
    sad_emojis = ["πŸ˜”", "πŸ™", "πŸ™", "☹️", "😿"]

    mood_satisfied = false
    puts "How are you feeling?"
    mood_description = gets.chomp

    while mood_satisfied == false do
    if mood_description == "happy"
    emoji = happy_emojis.sample
    elsif mood_description == "sad"
    emoji = sad_emojis.sample
    end

    puts "Does #{emoji} match your mood?"
    confirmation = gets.chomp
    confirmation = confirmation.downcase
    if ["y", "yes", "yep", "sure"].include? confirmation
    mood_satisfied = true
    else
    puts "Please give me another word to describe your mood"
    mood_description = gets.chomp
    end
    end

    puts "I recorded your answer."
  4. aeschright created this gist Dec 2, 2017.
    1 change: 1 addition & 0 deletions moods.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    #!/usr/local/env ruby