Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-armour committed Nov 17, 2023
1 parent 94b013a commit 21ba678
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cookbook/copilot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CoPilot Read Me

## 2023-11-16

What is the URL that obtains the list of all GitHub repositories for a user?

https://api.github.com/users/theo-armour/repos


What is the URL that obtains the list of only the homepage URLs for all GitHub repositories for a user?



Can you build a webpage that obtains the list of all GitHub repositories for a user and only displays the links to the "html_url"?

Can you build a webpage that obtains the list of all GitHub organizations for a user and only displays the links to the "html_url"?
31 changes: 31 additions & 0 deletions cookbook/copilot/get-user-organizations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>

<body>
<input type="text" id="username" placeholder="Enter GitHub username">
<button onclick="getOrgs()">Get Organizations</button>
<div id="orgs"></div>

<script>
function getOrgs () {
const username = document.getElementById( 'username' ).value;
fetch( `https://api.github.com/users/${ username }/orgs` )
.then( response => response.json() )
.then( data => {
const orgsDiv = document.getElementById( 'orgs' );
orgsDiv.innerHTML = ''; // clear the div
data.forEach( org => {
console.log( "org", org, org.html_url );
const a = document.createElement( 'a' );
a.href = "https://github.com/" + org.login;
a.textContent = org.login;
orgsDiv.appendChild( a );
orgsDiv.appendChild( document.createElement( 'br' ) ); // line break
} );
} )
.catch( error => console.error( 'Error:', error ) );
}
</script>
</body>

</html>
28 changes: 28 additions & 0 deletions cookbook/copilot/get-user-repos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<body>
<input type="text" id="username" placeholder="Enter GitHub username">
<button onclick="getRepos()">Get Repos</button>
<div id="repos"></div>

<script>
function getRepos() {
const username = document.getElementById('username').value;
fetch(`https://api.github.com/users/${username}/repos`)
.then(response => response.json())
.then(data => {
const reposDiv = document.getElementById('repos');
reposDiv.innerHTML = ''; // clear the div
data.forEach(repo => {
const a = document.createElement('a');
a.href = repo.html_url;
a.textContent = repo.name;
reposDiv.appendChild(a);
reposDiv.appendChild(document.createElement('br')); // line break
});
})
.catch(error => console.error('Error:', error));
}
</script>
</body>
</html>

0 comments on commit 21ba678

Please sign in to comment.