Guest User

jk

a guest
Apr 26th, 2009
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.41 KB | None | 0 0
  1. /**
  2.  * Easy tinyUrl usage from grails
  3.  * Put this code into bootstrap or somewhere where it will be executed once at startup
  4.  */
  5. String.metaClass.getTinyUrl = {
  6.   new URL("http://tinyurl.com/api-create.php?url=${delegate.encodeAsURL()}").text
  7. }
  8.  
  9. // now you can use the tinyUrl property of every string to get a tinyUrl for given address
  10. println "http://www.nabble.com/codehaus---grails-f11860.html".tinyUrl
  11.  
Add Comment
Please, Sign In to add comment