(function (window, jQuery) {
  $("tr.file-diff-line > td.diff-line-num-addition.empty-cell").each(function (index, cell) {
    var line = $(cell).parent().attr('data-line');
    var path = $(cell).parent().attr('data-path');
    
    // Fill in the path to the repo on your computer here
    var repoRoot = '/Users/nick/reporoot/';
    var openInTextmateUrl = 'txmt://open?url=file://' + repoRoot + path + '&line=' + line;
    $(cell).html('<a href="' + openInTextmateUrl + '">Txmt</a>');
  })
}(window, jQuery));

(function (window, jQuery) {
  // Fill in the path to the repo on your computer here
  var repoRoot = '/Users/nick/reporoot/';

  $('#files > .file').each(function (index, fileView) {
    var path = $(fileView).children('[data-path]').eq(0).attr('data-path');
    
    $(fileView).find('[data-line-number]').off().click(function () {
      var line = $(this).attr('data-line-number');
      var openInTextmateUrl = 'txmt://open?url=file://' + repoRoot + path + '&line=' + line;
      window.open(openInTextmateUrl, '_self');
    });
  });
}(window, jQuery));

Update to work with latest github UI changes
Update to work with latest github UI changes

Should work with both unified and split diff views