Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created June 20, 2013 00:19
Show Gist options
  • Select an option

  • Save metaskills/5819312 to your computer and use it in GitHub Desktop.

Select an option

Save metaskills/5819312 to your computer and use it in GitHub Desktop.
Short for `curl` content-length. I use this all the time, sometimes on my /assets/application.css to measure code bloat, if any.
curl-cl () {
local cl=$(curl -sI $1 | grep "Content-Length" | cut -d " " -f2)
echo $cl | ruby -r 'action_pack' -e 'require "action_view" ; include ActionView::Helpers::NumberHelper ; puts number_to_human_size(STDIN.read.strip, precision:2, separator:",")'
}
@metaskills
Copy link
Author

$ curl-cl http://myapp.dev/assets/applicatoin.css
782 Bytes

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