Skip to content

Instantly share code, notes, and snippets.

@jtrim
Created December 5, 2010 00:44
Show Gist options
  • Select an option

  • Save jtrim/728644 to your computer and use it in GitHub Desktop.

Select an option

Save jtrim/728644 to your computer and use it in GitHub Desktop.
Shell script that uses ruby to get a humanized version of a long date string. Copies to your clipboard and echoes to the command line. NOTE: Uses pbcopy to copy to the clipboard, which is only available on OSX. From terminal, run "dayahead 0" to get today
function dayahead() {
DAYSTRING=`ruby -e "require \"time\"; require \"date\"; puts Time.parse((Date.today + $1).to_s).strftime(\"%A, %B %d, %Y\")"`
echo -n $DAYSTRING | pbcopy
echo $DAYSTRING
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment