Skip to content

Instantly share code, notes, and snippets.

@sunny
Forked from CoralineAda/emoji-garden.rb
Last active July 28, 2026 15:35
Show Gist options
  • Select an option

  • Save sunny/206b194159cf722b4719acca88fc250d to your computer and use it in GitHub Desktop.

Select an option

Save sunny/206b194159cf722b4719acca88fc250d to your computer and use it in GitHub Desktop.
Emoji Garden
# frozen_string_literal: true
# Decorate your shared documents with an emoji garden, where collaborators can peacefully rest their cursors.
class EmojiGarden
PLANTS = %w{๐ŸŒฑ ๐ŸŒฟ โ˜˜๏ธ ๐Ÿ€ ๐ŸŽ‹ ๐Ÿƒ ๐Ÿ‚ ๐Ÿ ๐ŸŒพ ๐ŸŒต ๐ŸŒด ๐ŸŒณ ๐ŸŒฒ ๐Ÿชด ๐ŸŒธ ๐Ÿ’ฎ ๐Ÿต๏ธ ๐ŸŒบ ๐ŸŒป ๐ŸŒผ ๐ŸŒท ๐Ÿฅ€ ๐Ÿชท ๐Ÿชป ๐ŸŒน ๐Ÿ„ ๐ŸŒฑ ๐ŸŒฟ โ˜˜๏ธ ๐Ÿ€ ๐ŸŽ‹ ๐Ÿƒ ๐Ÿ‚ ๐Ÿ ๐ŸŒพ ๐ŸŒต ๐ŸŒด ๐ŸŒณ ๐ŸŒฒ ๐Ÿชด ๐ŸŒธ ๐Ÿ’ฎ ๐Ÿต๏ธ ๐ŸŒบ ๐ŸŒป ๐ŸŒผ ๐ŸŒท ๐Ÿฅ€ ๐Ÿชท ๐Ÿชป ๐ŸŒน ๐Ÿ„}
INSECTS = %w{๐Ÿœ ๐Ÿ ๐Ÿž ๐Ÿ› ๐Ÿฆ‹ ๐Ÿชฒ ๐Ÿชณ ๐Ÿชฐ ๐ŸฆŸ ๐Ÿ•ท๏ธ ๐Ÿ•ธ๏ธ ๐Ÿฆ‚}
HAPAX = %w{๐Ÿ‘ฝ}
SPACER = " "
DENSITY = 0.2
attr_accessor :rows, :columns, :hapax
def initialize(rows:, columns:)
@rows = rows;
@columns = columns
@hapax = false
end
def print
rows.times do
row = (PLANTS | INSECTS).sample.dup
row << SPACER
columns.times do
seed = rand(100)
if !hapax && seed == 1
character = HAPAX.sample
hapax = true
else
character = (seed > (DENSITY * 100)) ? (PLANTS | INSECTS).sample : " "
end
row << character
row << SPACER
end
puts row
end
end
end
EmojiGarden.new(rows: 5, columns: 10).print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment