Skip to content

Instantly share code, notes, and snippets.

@alexdresko
Last active January 3, 2018 15:32
Show Gist options
  • Save alexdresko/7b0c8dcc807a4ba4f5a74ef8a124cb68 to your computer and use it in GitHub Desktop.
Save alexdresko/7b0c8dcc807a4ba4f5a74ef8a124cb68 to your computer and use it in GitHub Desktop.
javascript:
var asdf = (window.getSelection && window.getSelection().toString()) || null;
if (!asdf || asdf === "") {
try {
asdf = document.getElementsByClassName('gh-header-title')[0].innerText
} catch (e) {}
}
if (!asdf) {
asdf = prompt("Enter the title");
}
try {
asdf = "gem " + /.*#(.*)/.exec(asdf)[1] + " " + /(.*) #/.exec(asdf)[1];
asdf = asdf.replace(/[ :]/g, "-").replace(/--/, "-");
alert(asdf);
} catch (e) {
alert("invalid input");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment