Updated! Now even more randomer!
Sometimes you need to let people know how you feel, sometimes words just don’t cut it. And sometimes you’re just too lazy to go to emojicons.com – I know that feeling. I know it well. In my opinion every pull request should finish with an emojicon to let people know how awesome you think they are. Thus I made an Alfred extension that will paste a random emojicon into whatever is currently selected.
The difficult part of it was copying unicode text into the pasteboard from a ruby script, so here’s the eventual solution as no-one really seems to have it.
# rubycocoa to the rescue! ns_string = OSX::NSString.stringWithString text) pb = OSX::NSPasteboard.generalPasteboard pb.declareTypes_owner_(["NSStringPboardType"], nil) pb.setString_forType_(ns_string, "NSStringPboardType") #paste `osascript -e 'tell application "System Events" to keystroke "v" using command down'`
make sure to `require “osx/cocoa”` and you’re set. Rock on.