Skip to content

Instantly share code, notes, and snippets.

@mistersourcerer
Created October 10, 2012 15:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mistersourcerer/3866215 to your computer and use it in GitHub Desktop.
Save mistersourcerer/3866215 to your computer and use it in GitHub Desktop.
Colorizing Ruby [or other lang] code from command line, to paste in keynote
#!/bin/bash
#http://pygments.org/docs/cmdline/
LANG="ruby"
if [ -n "$2" ]
then
LANG=$2;
fi
if [ -a "$1" ]
then
pygmentize -l $LANG -f rtf $1 | pbcopy
else
pbpaste | pygmentize -l $LANG -f rtf | pbcopy
fi
color myfile.rb
# or, if you have the code in your "Cmmd + C area"
color
# now just go to the keynote and hit Cmmd + V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment