Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Created April 8, 2013 18:13
Show Gist options
  • Save ddrscott/5339084 to your computer and use it in GitHub Desktop.
Save ddrscott/5339084 to your computer and use it in GitHub Desktop.
Rotating phases of the moon using Emoji.
# -*- coding: utf-8 -*-
# phases = %w{πŸŒ‘ πŸŒ’ πŸŒ“ πŸŒ” πŸŒ• πŸŒ– πŸŒ— 🌘}
phases = (0x1F311..0x1F318).to_a.collect{|c| [c].pack('U*')}
clear_line = "\r\e[0K"
1000.times do |i|
phase = phases[i % phases.size]
print "#{clear_line} #{phase}\t#{i} #{phase.unpack('U*').map{ |i| "\\u" + i.to_s(16).rjust(4, '0') }.join}"
sleep rand / 10.0
end
@lillypiri
Copy link

This is really cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment