Skip to content

Instantly share code, notes, and snippets.

@toothrot
Created February 3, 2012 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toothrot/1732927 to your computer and use it in GitHub Desktop.
Save toothrot/1732927 to your computer and use it in GitHub Desktop.
json formatting in your pipe because coderay doesn't do indentation
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'coderay'
json = ::JSON.pretty_generate(JSON.parse(STDIN.read))
puts ::CodeRay.encode(json, :json, :terminal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment