Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ahmadawais
Created April 3, 2019 10:57
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 ahmadawais/bb3d72332269670a32c4b06de028f10f to your computer and use it in GitHub Desktop.
Save ahmadawais/bb3d72332269670a32c4b06de028f10f to your computer and use it in GitHub Desktop.
/**
* Get GitHub usernames that contributed in a file.
*
* @author AhmadAwais <https://github.com/AhmadAwais>
* @since 2019-04-03
*/
const usernames = [];
// Select the right data of anchor links and loop over it.
document.querySelectorAll('.link-gray-dark.no-underline').forEach(lnk => {
// Username is the string's array's fourth item.
usernames.push(lnk.href.split('/')[3]);
});
// Make a list like username, username without quotes.
const ctrbs = usernames.join(', ');
// Add `, ` at the start and `, ahmadawais` at the end.
const final = ', '.concat(ctrbs).concat(', ahmadawais');
// Copy to your clipboard.
copy(final);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment