Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lytithwyn/550004 to your computer and use it in GitHub Desktop.
Save lytithwyn/550004 to your computer and use it in GitHub Desktop.
require 'coderay'
language = "auto";
if(ARGV.length > 0)
language = ARGV[0];
end
codeToHighlight = `xsel --clipboard`
highlightedCode = CodeRay.scan(codeToHighlight, language.intern()).div
IO.popen("xsel --clipboard", mode='w') do |io|
io.write highlightedCode
end
@BinaryMuse
Copy link

Mac OS X version :) http://gist.github.com/550075

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