Skip to content

Instantly share code, notes, and snippets.

@nsheridan
Created May 31, 2016 14:22
Show Gist options
  • Save nsheridan/81e4fc30f38ad7daff126ccebe212a93 to your computer and use it in GitHub Desktop.
Save nsheridan/81e4fc30f38ad7daff126ccebe212a93 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'clipboard'
num_emoji = ARGV.count == 1 && ARGV[0].to_i || 3
doc = Nokogiri::HTML(open('http://www.emoji-cheat-sheet.com/'))
emoji = doc.css('span.name').map(&:content)
emoji_str = emoji.sample(num_emoji).map {|em| ":#{em}:" }.join(' ')
Clipboard.copy(emoji_str)
puts "Copied to clipboard: #{emoji_str}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment