Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@avit
Created March 18, 2009 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save avit/80932 to your computer and use it in GitHub Desktop.
Save avit/80932 to your computer and use it in GitHub Desktop.
ToadMate Bookmarklet
Adds clickable links to open the file/line from the
stacktrace on Hoptoad (http://hoptoadapp.com) into TextMate.
INSTALL:
Change the lpd variable to your local project directory.
It relies on your project folders being named after the main part
of your domain name (example.com => /example/).
Drag the javascript to your browser bookmarks bar.
EXAMPLE:
in Hoptoad, if your site url is example.com, and you catch an error:
ExampleException raised in, e.g.:
app/controllers/posts_controller.rb:16
Click the Bookmarklet, then click the link that appears.
Fix your buggy ass file located at, e.g.:
/Users/andrew/Sites/example/app/controllers/posts_controller.rb
javascript:lpd='/Users/andrew/Sites/';htp=document.getElementsByClassName('url')[0].innerHTML.match(/http:\/\/(www\.)?([^\.]+)/)[2];htt=document.getElementById('backtrace').getElementsByTagName('p');for(i=0;i<htt.length;i++){m=htt[i].innerHTML.match(/^(On line #(\d+) of )?([^ ]+\.(e?rb|haml|builder))(:(\d+))?/);if(m){htt[i].innerHTML=htt[i].innerHTML.sub(m[3],'<a onclick="" href="txmt://open?url=file://'+lpd+htp+'/'+m[3]+'&line='+(m[6]||m[2])+'">'+m[3]+'</a>')}};void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment