Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate a random emoji bomb via the command-line
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
# Run `emojibomb` to get three emoji.
# Run `emojibomb N`, where `N` is a positive integer to get N emoji.
response = open("http://www.emoji-cheat-sheet.com/")
html = response.read
emoji = html.scan(/:\S+:/)
count = [ARGV.first.to_i, 3].max
bomb = ""
count.times do
bomb << emoji.sample
end
puts bomb
@shiftyp

This comment has been minimized.

Copy link

shiftyp commented Sep 27, 2019

I found this looking for random emojis in ruby. Here's another way to generate random emojis (I'm unsure about the exact range, but the method is simple).

rand(0x1F601..0x1F64F).chr('UTF-8')

emojis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.