Skip to content

Instantly share code, notes, and snippets.

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 szepnapot/ac7f90bc1516387d303ff7ec0c461427 to your computer and use it in GitHub Desktop.
Save szepnapot/ac7f90bc1516387d303ff7ec0c461427 to your computer and use it in GitHub Desktop.
get email from github user [https://stackoverflow.com/a/44229207/5682956]
<input id=username type="text" placeholder="github username or repo link">
<button onclick="fetch(`https://api.github.com/users/${username.value.replace(/^.*com[/]([^/]*).*$/,'$1')}/events/public`).then(e=> e.json()).then(e => [...new Set([].concat.apply([],e.filter(x => x.type==='PushEvent').map(x => x.payload.commits.map(c => c.author.email)))).values()]).then(x => results.innerText = x)">GO</button>
<div id=results></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment