Skip to content

Instantly share code, notes, and snippets.

View pitaj's full-sized avatar

Peter Jaszkowiak pitaj

View GitHub Profile
@pitaj
pitaj / Get the first commit url.js
Last active November 21, 2016 04:08 — forked from JamesWP/Get the first commit url.js
A snippet using the github public api to get the url and sha of the first commit for a given repo
// A snippet using the github public api to get
// the url and sha of the first commit for a given repo
function openFirstCommit(userorg, repo) {
return fetch('https://api.github.com/repos/'+userorg+'/'+repo+'/commits')
// the link header has additional urls for paging
// parse the original JSON for the case where no other pages exist
.then(res => Promise.all([res.headers.get('link'), res.json()]))
.then(([link, commits]) => {
if (link) {