Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Inspect a website like a string in Ruby

Put the following function into your ~/.bash_login (or alternatives).

   1  
   2  unset -f inspect_url
   3  
   4  function inspect_url() { 
   5     /usr/bin/curl -L -s --max-time 10 "${@}" | ruby -n -e 'p $_.to_s'
   6     return 0
   7  }
   8  
   9  inspect_url http://www.ruby-forum.com

introspection with python

   1  
   2  import inspect
   3  
   4  def info():
   5      loc = inspect.currentframe(1).f_locals # its locals
   6      glob = inspect.currentframe(1).f_globals # its globals
   7      fct = inspect.currentframe(1).f_code.co_name #calling function
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS