Skip to content

Instantly share code, notes, and snippets.

@hyuki
Created May 13, 2020 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/70f24af1e166d622cf66a14cd84d4b0e to your computer and use it in GitHub Desktop.
Save hyuki/70f24af1e166d622cf66a14cd84d4b0e to your computer and use it in GitHub Desktop.
TwitterMarkdownCommand.js - Convert URL to Command.
/*
* TwitterMarkdownCommand.js
*
* When you see:
* https://twitter.com/hyuki/status/1079981317184315392
* Then show the following line:
* twitter-markdown https://twitter.com/hyuki/status/1079981317184315392 | pbcopy
*/
function start() {
let url = location.href;
if (url.match(/^(https?:\/\/twitter\.com\/.*)/)) {
let cmd = 'twitter-markdown ' + RegExp.$1 + ' | pbcopy';
window.prompt("TwitterMarkdownCommand.js", cmd);
} else {
alert("Twitter URL is not found.\n" + url);
}
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment