Skip to content

Instantly share code, notes, and snippets.

@prettycode
Last active December 16, 2015 08:58
Show Gist options
  • Save prettycode/5409158 to your computer and use it in GitHub Desktop.
Save prettycode/5409158 to your computer and use it in GitHub Desktop.
A function that forks a Gist. You can use this to fork your own Gists.
function forkGist(user, gist) {
var path = (arguments.length ? ('/' + user + '/' + gist) : location.pathname);
var form = document.createElement('form');
form.method = 'post';
form.action = 'https://gist.github.com' + path + '/fork',
form.submit();
}
// Paste into browser console when viewing a Gist (including your own) to fork it
forkGist();
// Fork a Gist from anywhere
forkGist('prettycode', 5409158);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment