From eb794ad1b05577b4ffe16c7fdc85aae2bdc8d3c5 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Wed, 4 Sep 2024 10:43:13 +1000 Subject: [PATCH 1/7] Create codespace.md (#1) * Create codespace.md * Update codespace.md --- codespace.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 codespace.md diff --git a/codespace.md b/codespace.md new file mode 100644 index 0000000..a7f61db --- /dev/null +++ b/codespace.md @@ -0,0 +1,60 @@ +# Using GitHub Codespaces + +## What is GitHub Codespaces? + +GitHub Codespaces is a cloud-based development environment that allows you to run your code directly from within GitHub. It provides a fully-featured, configurable, and on-demand development environment that can be accessed from anywhere. With GitHub Codespaces, you can: + +- Develop in a consistent environment across different machines. +- Quickly start coding without setting up your local environment. +- Use powerful cloud-based resources for development. + +## How to Spin Up a Codespace Instance + +Follow these steps to spin up a Codespace instance using the `devcontainer` file: + +### Step 1: Navigate to Your Repository + +1. Go to your repository on GitHub. In this case, navigate to [qldgov-sandbox/copilot-node-calculator](https://github.com/qldgov-sandbox/copilot-node-calculator). + +### Step 2: Open Codespaces + +2. Click on the `Code` button on the repository page. + +![image](https://github.com/user-attachments/assets/5ecb1522-6106-4d8c-b2a3-28b969833c37) + +3. Select the `Codespaces` tab. + +![image](https://github.com/user-attachments/assets/078529d9-3f8c-4b53-b458-8f73ca36074c) + +4. Click on `New codespace` to create a new Codespace. + +![image](https://github.com/user-attachments/assets/cf2d0ec0-6183-4389-8158-2487055371fa) + +### Step 3: Configure Your Codespace + +5. GitHub Codespaces will automatically detect the `devcontainer.json` file in your repository and use it to set up your development environment. + +6. Wait for the Codespace to start. This might take a few minutes as it sets up the environment according to the configurations specified in the `devcontainer.json` file. + +### Step 4: Start Coding + +7. Once the Codespace is ready, you will be taken to a VS Code-like interface in your browser. You can now start coding in the environment that has been set up according to your `devcontainer.json` file. + +![image](https://github.com/user-attachments/assets/e450ae7d-cfc3-4272-a498-22999b36d264) + +### Step 5: Accessing Terminal and Other Features + +8. You can access the terminal by clicking on the menu and selecting `View > Terminal`. + +![image](https://github.com/user-attachments/assets/4e8eabc2-e9ae-48a0-8c21-a1fb60ebbcb2) + +9. Use the terminal to run commands, install dependencies, and test your code. + +### Additional Tips + +- You can customize your development environment further by modifying the `devcontainer.json` file. +- Codespaces supports extensions, themes, and other VS Code features, which you can install to enhance your development experience. + +## Conclusion + +GitHub Codespaces provides a powerful and flexible development environment that you can access from anywhere. By following the steps above, you can quickly spin up a Codespace instance and start coding using the `devcontainer.json` file you created. From dced3ea256a00aaea2ccda7aa10149dd52279821 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Wed, 4 Sep 2024 12:01:41 +1000 Subject: [PATCH 2/7] New codespace (#2) * updated * update extension version --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ffdd4d3..ac5358d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,8 +10,8 @@ "customizations": { "vscode": { "extensions": [ - "GitHub.copilot", - "GitHub.copilot-labs" + "GitHub.copilot@1.226.0", + "GitHub.copilot-chat@0.20.2024090302" ] } }, From 78142607b47f77fe357342155e042e1a4ed1e3c5 Mon Sep 17 00:00:00 2001 From: Emad Alashi Date: Fri, 6 Sep 2024 08:24:58 +1000 Subject: [PATCH 3/7] chore: Update challenge exercises instructions --- .instructions/3. challenge exercises.md | 78 +++++++++++++++++++++++++ README.md | 4 -- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/.instructions/3. challenge exercises.md b/.instructions/3. challenge exercises.md index ac546d2..d0f4d49 100644 --- a/.instructions/3. challenge exercises.md +++ b/.instructions/3. challenge exercises.md @@ -50,6 +50,84 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num +
+Challenge #4 - Fix errors + +### Fix errors +1. Go to the `controller.js` file on line 19, and and a single comma. This will generate a compiler error. +2. Ask Copilot to help you fix the error +
+ +
+Challenge #5 - Explaining the controller.js file + +### Explaining the controller.js file + +1. Navigate to the `controller.js` file in your project. + +2. Use GitHub Copilot to help you explain the purpose and functionality of the `controller.js` file. Ask Copilot to generate comments or descriptions for different sections of the code. + +3. Review the generated explanations and make any necessary edits or additions to ensure clarity and accuracy. + +
+ +
+Challenge #9 - Improving Code Reuse + +### Improving Code Reuse + +1. Navigate to the `controller.js` file in your project. + +2. Select the lines between 32 and 42, which contain code that could benefit from better code reuse. + +3. Ask Copilot to rewrite the selected code to improve code reuse. Provide a comment to indicate what you want Copilot to do, such as `// Improve code reuse in this section`. + +4. Review the generated suggestions and make any necessary edits or additions to ensure the code is refactored for better code reuse. + +5. Test the refactored code to ensure it still functions as expected. + +
+ +
+Challenge #6 - Generating Sample Data for Testing + +### Generating Sample Data for Testing + +1. Navigate to the `controller.js` file in your project. + +2. Use GitHub Copilot Chat to generate sample data that can be used for testing. Ask Copilot Chat to provide at least 3 lines of sample data for each test. + +3. Review the generated sample data and make any necessary edits or additions to ensure it meets your testing requirements. + +
+ +
+Challenge #7 - Generating Documentation + +### Generating Documentation + +1. Navigate to the `controller.js` file in your project. + +2. Use GitHub Copilot to generate documentation for the `controller.js` file. Ask Copilot to provide comments or descriptions for different sections of the code, explaining the purpose and functionality of each section. + +3. Review the generated documentation and make any necessary edits or additions to ensure clarity and accuracy. + +4. Repeat the same process for the `index.html` file, generating documentation for different sections of the code. + +
+ +
+Challenge #8 - Converting to CSharp + +### Converting to CSharp + +1. Navigate to the `controller.js` file in your project. + +2. Use GitHub Copilot Chat to assist you in converting the `controller.js` file into CSharp code. Ask Copilot Chat to provide suggestions and guidance on how to rewrite the code in CSharp. + +3. Review the generated suggestions and make any necessary edits or additions to ensure the code is correctly converted to CSharp. + +
#### What's next? diff --git a/README.md b/README.md index 3af9b60..431da93 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,6 @@ Filename | Description [4. additional resources.md]() | Additional resources for participants to explore after the workshop. -## Running a workshop? - -If you're planning to run a GitHub Copilot workshop, please review the [workshop guide]() for tips and tricks to help you run a successful workshop. - ## Project Structure From f514d64d552d6a5d44ee02cc6cfe37617583aed6 Mon Sep 17 00:00:00 2001 From: Emad Alashi Date: Fri, 6 Sep 2024 08:34:05 +1000 Subject: [PATCH 4/7] Reorder Challenges --- .instructions/3. challenge exercises.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.instructions/3. challenge exercises.md b/.instructions/3. challenge exercises.md index d0f4d49..be22f10 100644 --- a/.instructions/3. challenge exercises.md +++ b/.instructions/3. challenge exercises.md @@ -72,7 +72,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #9 - Improving Code Reuse +Challenge #6 - Improving Code Reuse ### Improving Code Reuse @@ -89,7 +89,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #6 - Generating Sample Data for Testing +Challenge #7 - Generating Sample Data for Testing ### Generating Sample Data for Testing @@ -102,7 +102,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #7 - Generating Documentation +Challenge #8 - Generating Documentation ### Generating Documentation @@ -117,7 +117,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #8 - Converting to CSharp +Challenge #9 - Converting to CSharp ### Converting to CSharp From 0d681e1c5b72916952bbcbedc8fbf313fd9d7c92 Mon Sep 17 00:00:00 2001 From: Emad Alashi Date: Wed, 11 Sep 2024 14:17:14 +1000 Subject: [PATCH 5/7] Moved explaining code to be the first challenge --- .instructions/3. challenge exercises.md | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.instructions/3. challenge exercises.md b/.instructions/3. challenge exercises.md index be22f10..86429bd 100644 --- a/.instructions/3. challenge exercises.md +++ b/.instructions/3. challenge exercises.md @@ -2,9 +2,22 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a number of challenges for you to attempt. Remember the goal here is not to test your programming abilities but rather, see how you can use GitHub Copilot to help you complete these tasks. Even if you're not a developer, you may be surprised how Copilot can help you be successful with these challenge. +
+Challenge #1 - Explaining the controller.js file + +### Explaining the controller.js file + +1. Navigate to the `controller.js` file in your project. + +2. Use GitHub Copilot to help you explain the purpose and functionality of the `controller.js` file. Ask Copilot to generate comments or descriptions for different sections of the code. + +3. Review the generated explanations and make any necessary edits or additions to ensure clarity and accuracy. + +
+
-Challenge #1 - Adding Unit Tests +Challenge #2 - Adding Unit Tests ### Adding Unit Tests @@ -31,7 +44,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #2 - Adding Unit Tests for the power/exponential function +Challenge #3 - Adding Unit Tests for the power/exponential function ### Adding Unit Tests for the power/exponential function @@ -40,7 +53,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #3 - Adding a new function +Challenge #4 - Adding a new function ### Adding a new function @@ -51,26 +64,13 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
-Challenge #4 - Fix errors +Challenge #5 - Fix errors ### Fix errors 1. Go to the `controller.js` file on line 19, and and a single comma. This will generate a compiler error. 2. Ask Copilot to help you fix the error
-
-Challenge #5 - Explaining the controller.js file - -### Explaining the controller.js file - -1. Navigate to the `controller.js` file in your project. - -2. Use GitHub Copilot to help you explain the purpose and functionality of the `controller.js` file. Ask Copilot to generate comments or descriptions for different sections of the code. - -3. Review the generated explanations and make any necessary edits or additions to ensure clarity and accuracy. - -
-
Challenge #6 - Improving Code Reuse From e410600bfa969846e106c5056e72abe97ca798e6 Mon Sep 17 00:00:00 2001 From: Emad Alashi Date: Wed, 11 Sep 2024 14:24:11 +1000 Subject: [PATCH 6/7] Add a challenge to use chat participants --- .instructions/3. challenge exercises.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.instructions/3. challenge exercises.md b/.instructions/3. challenge exercises.md index 86429bd..d242854 100644 --- a/.instructions/3. challenge exercises.md +++ b/.instructions/3. challenge exercises.md @@ -129,6 +129,20 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num
+
+Challenge #10 - Understanding Calculation Logic + +### Asking questions about the workspace + +1. Open the GitHub Copilot chat window in the side bar. + +2. In the chat window, type `@workspace` to mention the @workspace chat participant. + +3. Ask the @workspace participant about this code project. For example, ask "what are the main routes in this application" + +
+ + #### What's next? Once you've completed the challenges, you may like to review the [additional resources](<./4. additional resources.md>) From acb785a2628325a2df93ea023ea49b65674f9b42 Mon Sep 17 00:00:00 2001 From: Emad Alashi Date: Wed, 11 Sep 2024 15:14:56 +1000 Subject: [PATCH 7/7] Fix a prompt guidance in challenge 6 --- .instructions/3. challenge exercises.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.instructions/3. challenge exercises.md b/.instructions/3. challenge exercises.md index d242854..2c69625 100644 --- a/.instructions/3. challenge exercises.md +++ b/.instructions/3. challenge exercises.md @@ -80,7 +80,7 @@ Now you've had an opportunity to get started using GitHub Copilot, we have a num 2. Select the lines between 32 and 42, which contain code that could benefit from better code reuse. -3. Ask Copilot to rewrite the selected code to improve code reuse. Provide a comment to indicate what you want Copilot to do, such as `// Improve code reuse in this section`. +3. Ask Copilot to rewrite the selected code to improve code reuse. Provide a prompt to indicate what you want Copilot to do, such as `Improve code reuse in this section`. Use inline Copilot chat, or the chat window in the side bar. 4. Review the generated suggestions and make any necessary edits or additions to ensure the code is refactored for better code reuse.