From 70648cd3577bc5d75bcd6e51361a85219972d838 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Mon, 18 Nov 2024 11:25:03 -0500 Subject: [PATCH 1/9] move assignment to shell repo --- 02_activities/assignments/git_assignment.md | 66 +-------------------- 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/02_activities/assignments/git_assignment.md b/02_activities/assignments/git_assignment.md index a2507de..877c5f3 100644 --- a/02_activities/assignments/git_assignment.md +++ b/02_activities/assignments/git_assignment.md @@ -1,66 +1,4 @@ # Git Assignment -In this assignment, you will be learning more about `git` and `GitHub` by working through the questions. As you answer the questions, you will practice your git skills by staging, committing and pushing your answers (changes) along the way. - -1. Create a new public repository called `git_assignment` without a `README.md` -2. Clone it to your local computer -3. Create a `README.md` and paste the following code inside: - - ```markdown - # Git Assignment - - ``` - -4. Stage, commit and push the repo -5. Create a new branch called `assignment` -6. In your `README.md`, answer the following questions: - - > a. What is an _issue_? - - > b. What is a _pull request_? - - > c. Describe the steps to open a _pull request_? - - > d. Describe the steps to add a collaborator to a repository (share write permissions) - - > e. What is the difference between `git` and `GitHub`? - - > f. What does `git diff` do? - - > g. What is the `main` branch? - - > h. Besides our initial commit if it is a new repository, should we directly push our changes directly into the `main` branch? - - -Feel free to at any point (recommended after answering every 2 questions) to stage, commit and push your work to GitHub. It is a great way to practice using `git`! - -1. When you are done, please stage, commit your changes, and push it to GitHub. -2. Open up a pull request. -3. Write down in your pull request what you learned from this assignment. ([Guidelines for Pull Request Descriptions](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md#guidelines-for-pull-request-descriptions)) - -## Criteria - -|Criteria|Complete|Incomplete| -|---|---|---| -|Branching|A new branch was created and used|A new branch was not created and used.| -|Pull Request|A pull request with the answers to the questions was made.|No pull request or answers were made.| -|Explanation Quality|Each answer per question is clear and concise.|Each answer per question is inconclusive.| - -## Submission Information - -🚨 **Please review our [Assignment Submission Guide](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md)** 🚨 for detailed instructions on how to format, branch, and submit your work. Following these guidelines is crucial for your submissions to be evaluated correctly. - -### Submission Parameters: -* Submission Due Date: `2024-08-25 - 23:59` -* The branch name for your repo should be: `assignment` -* What to submit for this assignment: - * The mentioned markdown file above (README.md) should be populated with what we have asked for and should be the only change in your pull request. -* What the pull request link should look like for this assignment: `https://github.com//git_assignment/pull/` - * Open a private window in your browser. Copy and paste the link to your pull request into the address bar. Make sure you can see your pull request properly. This helps the technical facilitator and learning support staff review your submission easily. - -Checklist: -- [ ] Create a branch called `assignment`. -- [ ] Ensure that the repository is public. -- [ ] Review [the PR description guidelines](https://github.com/UofT-DSI/onboarding/blob/main/onboarding_documents/submissions.md#guidelines-for-pull-request-descriptions) and adhere to them. -- [ ] Verify that the link is accessible in a private browser window. - -If you encounter any difficulties or have questions, please don't hesitate to reach out to our team via our Slack at `#cohort-3-help`. Our Technical Facilitators and Learning Support staff are here to help you navigate any challenges. +The combined Shell and Git module assignments can be found in the Shell repository. +https://github.com/UofT-DSI/shell/blob/main/02_activities/assignments/assignment_instructions.md From 316677dec1e229e29fe196c1de53b2ddf268e995 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Fri, 21 Mar 2025 13:30:07 -0400 Subject: [PATCH 2/9] add git practice homework problems --- .../homework/git_advanced.md | 17 +- 02_activities/homework/git_basics.md | 3 + .../{git_homework_1.md => git_moderate.md} | 17 +- .../githubpages/git_basics.yml | 321 +++++++++++++++ .../githubpages/interactive_problems.html | 381 ++++++++++++++++++ 5 files changed, 715 insertions(+), 24 deletions(-) rename 03_instructional_team/homework/git_homework_2.md => 02_activities/homework/git_advanced.md (63%) create mode 100644 02_activities/homework/git_basics.md rename 02_activities/homework/{git_homework_1.md => git_moderate.md} (62%) create mode 100644 03_instructional_team/githubpages/git_basics.yml create mode 100644 03_instructional_team/githubpages/interactive_problems.html diff --git a/03_instructional_team/homework/git_homework_2.md b/02_activities/homework/git_advanced.md similarity index 63% rename from 03_instructional_team/homework/git_homework_2.md rename to 02_activities/homework/git_advanced.md index 657edfd..813774b 100644 --- a/03_instructional_team/homework/git_homework_2.md +++ b/02_activities/homework/git_advanced.md @@ -1,15 +1,10 @@ - - -# Git Homework 2 - -## Short answer -1. What makes a good Git commit message? Write your answer in the Google Doc +# Git Advanced Homework ## Tasks -The `DSI/git_homework-2` repository contains a short Python script that +The `dtxe/DSI_git_assignment` repository contains a short Python script that loads the TTC Bus Delay dataset, computes the average delay by route, then plots the average delay as a histogram. - +s 1. Clone this repository: https://github.com/dtxe/DSI_git_assignment * `git clone` @@ -21,7 +16,6 @@ get this code working by merging the fixes. 1. Check the current status and commit history * `git status` and `git log` 2. Merge the `bugfix1` branch into the main branch -3. 📸 Take a screenshot of your terminal output ### Task 2 We've also been working on an additional feature in a separate branch. @@ -30,7 +24,6 @@ This allows us to aggregate the data by any arbitrary column in the DataFrame, n Let's merge this feature in. 1. Merge the `feature1` branch into the main branch. -2. 📸 Take a screenshot of your terminal output ### Task 3 Uh oh! It looks like there's a merge conflict between the bugfix and the new feature! @@ -38,9 +31,5 @@ Uh oh! It looks like there's a merge conflict between the bugfix and the new fea 1. Resolve the merge conflict in your choice of editor * We suggest using VSCode! 2. Complete the merge after fixing the conflict. -3. 📸 Take a screenshot of your terminal output -4. Copy and paste the new Analyze.py file into the Google Doc -## Submission -* Submit your screenshots and the contents of the new Analyze.py file in a Google Doc inside your submission folder diff --git a/02_activities/homework/git_basics.md b/02_activities/homework/git_basics.md new file mode 100644 index 0000000..cccd4de --- /dev/null +++ b/02_activities/homework/git_basics.md @@ -0,0 +1,3 @@ +# Git Basic Practice Problems + +Load the basic practice problems in your browser here: https://uoft-dsi.github.io/git/interactive_problems.html#git_basics diff --git a/02_activities/homework/git_homework_1.md b/02_activities/homework/git_moderate.md similarity index 62% rename from 02_activities/homework/git_homework_1.md rename to 02_activities/homework/git_moderate.md index 4021721..2858568 100644 --- a/02_activities/homework/git_homework_1.md +++ b/02_activities/homework/git_moderate.md @@ -1,4 +1,4 @@ -# Git Homework 1 +# Git Basics ## Tasks ### Task 1 @@ -8,26 +8,23 @@ 4. Using the git command line, add this file to staging, then commit the file to your repository with a suitable commit message. * `git add ` then `git commit` 5. Write a suitable commit message and finalize your commit -6. 📸 Take a screenshot of your terminal output 8. Show the commit history * `git log` -9. 📸 Take a screenshot of your terminal output + ### Task 2 1. Create a new public repository on GitHub 2. Add your GitHub repository as a remote for your local `githomework1` repository * `git remote add origin ` 3. Push your local `githomework1` repository to GitHub -4. Include your repository URL in your submission + ### Task 3 1. Create a new branch called `playing-with-bash` -2. Create 5 empty files with the names up to you -3. Use `echo` into the 5 empty files a few sentences about anything +2. Create 5 text files with the names up to you, and with placeholder contents 4. Stage, commit and push your work on GitHub 5. Open up a pull request -### Submission - -1. When you are done, please commit your changes, and push it to GitHub. -2. Open up a pull request and add your Learning Support Person as a reviewer. You may need to add them to your repository. +### Task 4 +1. Explore your repository on GitHub and check that all your files and commit messages are here. + * If not, did you push all your branches? diff --git a/03_instructional_team/githubpages/git_basics.yml b/03_instructional_team/githubpages/git_basics.yml new file mode 100644 index 0000000..6db4180 --- /dev/null +++ b/03_instructional_team/githubpages/git_basics.yml @@ -0,0 +1,321 @@ +title: Git Basics Practice Problems +problems: + - title: Git commands + description: | + You're starting a new project called `my_project` and would like your code to be version controlled. + From your home directory, which commands will create a new directory called `my_project` and initialize a new Git repository? + questiontype: parsons + options: + - "`mkdir my_project`" + - "`cd my_project`" + - "`git init`" + - "`git clone`" + - "`git create`" + - "`git add my_project`" + - "`git mkdir my_project`" + correct_options: [0,1,2] + solution: | + To create a new directory and initialize a Git repository, you would use the following commands: + 1. `mkdir my_project` - This creates a new directory called `my_project`. + 2. `cd my_project` - This changes the current working directory to `my_project`. + 3. `git init` - This initializes a new Git repository in the current directory. + + The other commands are either incorrect or not necessary for this task. + + - title: Git commands + description: | + This is your terminal prompt: + ```bash + user@computer:~$ ls + Desktop Documents Downloads Music Pictures Videos my_project + user@computer:~$ + ``` + You might have made a change to a file in the `my_project` directory, but you're not sure. + How would you check if your working directory is clean? (eg. no uncommitted changes) + questiontype: parsons + options: + - "`cd my_project`" + - "`git status`" + - "`git log`" + - "`git diff`" + - "`git commit -am 'commit all changes`" + - "`git push`" + - "`git pull`" + - "`git checkout`" + - "`git add -A`" + correct_options: [0,1] + solution: | + To check if your working directory is clean, you would use the following commands: + 1. `cd my_project` - This changes the current working directory to `my_project`. + 2. `git status` - This shows the status of the working directory and staging area, including any uncommitted changes. + + The other commands are either not relevant or not necessary for this task. + + - title: Git commands + description: | + You've just started a new project and initialized a Git repository. + This is your current terminal prompt: + ```bash + user@computer:~/my_project$ ls + user@computer:~/my_project$ + ``` + How would you create a new file called `README.md`, add it to the staging area, and commit it? + questiontype: parsons + options: + - "`touch README.md`" + - "`git add README.md`" + - "`git commit -m 'Add README file'`" + - "`git push`" + - "`git init`" + - "`git status`" + - "`git log`" + - "`git clone`" + - "`git pull`" + - "`git add and commit README.md`" + - "`git create README.md`" + - "`git commit -am 'Add README file'`" + correct_options: [0,1,2] + solution: | + To create a new file, add it to the staging area, and commit it, you would use the following commands: + 1. `touch README.md` - This creates a new file called `README.md`. + 2. `git add README.md` - This adds the file to the staging area. + 3. `git commit -m 'Add README file'` - This commits the changes with a message. + + Using `git commit -am 'Add README file'` would not work in this case because `README.md` is a + new file that has never been added to the repository before. + The `-a` flag only stages files that are already being tracked by Git. (eg. modified files) + + - title: Git commands + description: | + You have a file called `script.py` in your Git repository. + You made some changes to it and want to see what those changes are before committing. + Which command would you use? + questiontype: parsons + options: + - "`git status`" + - "`git diff script.py`" + - "`git log`" + - "`git commit -m 'Update script.py'`" + - "`git add script.py`" + - "`git push`" + - "`git pull`" + - "`git checkout script.py`" + - "`cd script.py`" + correct_options: [1] + solution: | + To see the changes made to `script.py`, you would use the command: + `git diff script.py` - This shows the differences between the working directory and the staging area for the specified file. + + - title: Git and GitHub + description: | + What is the difference between git and GitHub? + questiontype: freeform + solution: | + Git is a version control system that allows you to track changes in your code and collaborate with others. + GitHub is a web-based platform that uses Git for version control and provides additional features like issue tracking, pull requests, and project management. + In short, Git is the tool, while GitHub is a service that hosts Git repositories. + + - title: Git and GitHub + description: | + Besides the initial commit, should we push our changes directly into the `main` branch? + questiontype: freeform + solution: | + It depends. + + For **smaller projects**, it might be acceptable to push changes directly to the `main` branch. + This can be convenient for quick iterations and personal projects where you are the only developer. + + However, for **larger projects** or when working in a team, it's generally recommended to create a new branch for each feature or bug fix. + This allows for better organization and collaboration, as well as easier code reviews. + By using branches, you can work on multiple features or fixes simultaneously without affecting the main codebase. + Once your changes are complete and tested, you can merge them back into the `main` branch through a pull request. + This helps maintain a clean and organized project history. + + - title: Command line text editors + description: | + You've just installed Git on a new computer and are excited to keep working on your project in Git. + You've made some changes, added them to staging with `git add -A`, then went to commit your changes with + `git commit`. When you press Enter, you see this on screen. + + ``` + + # Please enter the commit message for your changes. Lines starting + # with '#' will be ignored, and an empty message aborts the commit. + # + # On branch main + # Your branch is ahead of 'origin/main' by 1 commit. + # (use "git push" to publish your local commits) + # + # Changes to be committed: + # modified: myfile.txt + # + ~ + ~ + ~ + ~ + ~ + .git/COMMIT_EDITMSG [unix] + "~/myproject/.git/COMMIT_EDITMSG" + ``` + + Pressing keys on your keyboard doesn't seem to do anything. + What is going on? How do you get out of this screen? + + questiontype: multiplechoice + options: + - "You are in a command line text editor called `vim`. To exit, press `Esc`, then type `:wq` and press Enter." + - "You are in a command line text editor called `vim`. To exit, press `Ctrl + Q`." + - "You are in a command line text editor called `vim`. To exit, press `Ctrl + X`, then press Esc." + - "You are in a command line text editor called `nano`. To exit, press `Ctrl + X`, then type `Y` to save changes." + - "You are in a command line text editor called `nano`. To exit, press `Ctrl + Q`." + - "You are in a command line text editor called `nano`. To exit, press `Esc`, then type `:wq` and press Enter." + correct_options: [0] + solution: | + You are in a command line text editor called `vim`. To exit, press `Esc`, then type `:wq` and press Enter. + This will save your changes and exit the editor. If you want to exit without saving, you can type `:q!` instead. + + You can tell that this is `vim` because of the `~` symbols, which indicate empty lines in `vim`, and the "~/myproject/.git/COMMIT_EDITMSG" file path at the bottom. + + - title: Command line text editors + description: | + You've just installed Git on a new computer and are excited to keep working on your project in Git. + You've made some changes, added them to staging with `git add -A`, then went to commit your changes with + `git commit`. When you press Enter, you see this on screen. + + ``` + GNU nano 8.3 COMMIT_EDITMSG + + # Please enter the commit message for your changes. Lines starting + # with '#' will be ignored, and an empty message aborts the commit. + # + # On branch main + # Your branch is ahead of 'origin/main' by 1 commit. + # (use "git push" to publish your local commits) + # + # Changes to be committed: + # modified: myfile.txt + # + [ Read 148 lines (converted from DOS format) ] + ^G Help ^O Write Out ^F Where Is ^K Cut + ^X Exit ^R Read File ^\ Replace ^U Paste + ``` + Pressing keys on your keyboard types onto the screen. + What is going on? How do you get out of this screen? + questiontype: multiplechoice + options: + - "You are in a command line text editor called `vim`. To exit, press `Esc`, then type `:wq` and press Enter." + - "You are in a command line text editor called `vim`. To exit, press `Ctrl + Q`." + - "You are in a command line text editor called `vim`. To exit, press `Ctrl + X`, then press Esc." + - "You are in a command line text editor called `nano`. To exit, press `Ctrl + X`, then type `Y` to save changes." + - "You are in a command line text editor called `nano`. To exit, press `Ctrl + Q`." + - "You are in a command line text editor called `nano`. To exit, press `Esc`, then type `:wq` and press Enter." + correct_options: [3] + solution: | + You are in a command line text editor called `nano`. To exit, press `Ctrl + X`, then type `Y` to save changes. + These keyboard shortcuts are indicated at the bottom of the screen, where `^X` means `Ctrl + X` + + This will save your changes and exit the editor. If you want to exit without saving, you can type `N` instead of `Y`. + + You can tell that this is `nano` because of the application name at the top (GNU nano 8.3) and the keyboard shortcuts listed at the bottom. + + - title: Commit messages + description: | + Suppose you had a recipe for guacamole in a file called `guacamole.txt`. + ``` + Guacamole ingredients: + - avocado + - lemon + - salt + ``` + + You change this file to the following: + ``` + Guacamole ingredients: + - avocado + - lime + - salt + - cilantro + ``` + + What would be a good commit message for this change? + + questiontype: multiplechoice + options: + - "Fixed a typo in guacamole.txt" + - "Updated guacamole recipe to use lime instead of lemon and added cilantro" + - "Added new ingredients to guacamole recipe" + - "Changed guacamole recipe" + - "Guacamole recipe update" + - "Guacamole modified to the traditional recipe" + correct_options: [5] + solution: | + A good commit message should be clear and descriptive, explaining what changes were made and why. + The best option here is: + "Guacamole modified to the traditional recipe" + + This message clearly states what was changed and why, making it easy for others (and yourself) to understand the purpose of the commit in the future. + + - "Fixed a typo in guacamole.txt" is not accurate because there was no typo. + - "Updated guacamole recipe to use lime instead of lemon and added cilantro" duplicates the information in the `git diff` and does not explain why + - "Added new ingredients to guacamole recipe" is vague and doesn't specify what was changed. + - "Changed guacamole recipe" is too vague and doesn't provide enough information. + - "Guacamole recipe update" is also vague and doesn't explain what was changed. + + - title: Git commands + description: | + You're working on two features simultaneously in your Git repository: `feature1` and `feature2`. + `feature1` and `feature2` were branched off of `main` some time ago. + You don't remember if you've fixed a particular bug in `feature1` or `feature2` or `main`. + + How would you check which branch your bugfix commit has been made in? + + questiontype: multiplechoice + options: + - "`git log [branch name]` for each branch" + - "`git log` then `git checkout [branch]` for each branch" + - "`git diff main feature1 feature2`" + - "`git status [branch name]` for each branch" + correct_options: [0] + solution: | + The best way to check which branch your bugfix commit has been made in is to use: + "`git log [branch name]` for each branch" + + This will show you the commit history for each branch, allowing you to see if the bugfix commit is present in that branch. + + The other options are not correct because: + - "`git log` then `git checkout [branch]` for each branch" runs the commands in the wrong order, and using `git checkout` would require checking out each branch, which is unnecessary. + - "`git diff`" shows differences between branches but does not show commit history, and `git diff main feature1 feature2` is not a valid command. + - "`git status [branch name]` for each branch" does not provide information about commit history. + + - title: Git remotes + description: | + You're working on the DSI Shell & Git assignment. + 1. You've cloned the repository from GitHub to your local machine. + 1. You've made some changes to the code and committed + 1. Now you want to push your changes to the remote repository on GitHub. + + But you've realized that *instead of cloning your own fork of the repository, you accidentally cloned the original repository.* + + How would you fix this and push your changes to your own fork of the repository? + questiontype: parsons + options: + - "`git remote add origin [your fork URL]`" + - "`git remote rename origin upstream`" + - "`git push origin main`" + - "`git clone [your fork URL]`" + - "`git fetch origin`" + - "`git pull origin main`" + - "`git remote reset origin`" + - "`git reclone [your fork URL]`" + correct_options: [1,0,2] + solution: | + To fix this and push your changes to your own fork of the repository, you would do the following: + 1. `git remote rename origin upstream` - This renames the original repository to `upstream`. + 2. `git remote add origin [your fork URL]` - This adds your fork as the new `origin`. + 3. `git push origin main` - This pushes your changes to your fork on GitHub. + + The other commands are either not necessary or incorrect for this task. + - `git fetch origin` and `git pull origin main` are not needed because you already have the latest changes from the original repository. + - `git reclone [your fork URL]` is not a valid command. + - `git remote reset origin` is not a valid command. + - `git clone [your fork URL]` would create a new clone of your fork, which is not necessary if you already have a local copy. diff --git a/03_instructional_team/githubpages/interactive_problems.html b/03_instructional_team/githubpages/interactive_problems.html new file mode 100644 index 0000000..464084e --- /dev/null +++ b/03_instructional_team/githubpages/interactive_problems.html @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + +
+
+
+

+
+
+
+ + + + \ No newline at end of file From 526df35df0462efa74b9c87f10d5af2a480bb51a Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Fri, 21 Mar 2025 13:30:57 -0400 Subject: [PATCH 3/9] add more prominent notice about optional nature of homework --- 02_activities/homework/git_advanced.md | 2 ++ 02_activities/homework/git_basics.md | 2 ++ 02_activities/homework/git_moderate.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/02_activities/homework/git_advanced.md b/02_activities/homework/git_advanced.md index 813774b..72a126a 100644 --- a/02_activities/homework/git_advanced.md +++ b/02_activities/homework/git_advanced.md @@ -1,5 +1,7 @@ # Git Advanced Homework +**Note**: Homework problems are not assessed and are provided for your own personal practice. Feel free to discuss these with your peers and learning support during work sessions! + ## Tasks The `dtxe/DSI_git_assignment` repository contains a short Python script that loads the TTC Bus Delay dataset, computes the average delay by route, then diff --git a/02_activities/homework/git_basics.md b/02_activities/homework/git_basics.md index cccd4de..3f12cff 100644 --- a/02_activities/homework/git_basics.md +++ b/02_activities/homework/git_basics.md @@ -1,3 +1,5 @@ # Git Basic Practice Problems Load the basic practice problems in your browser here: https://uoft-dsi.github.io/git/interactive_problems.html#git_basics + +**Note**: Homework problems are not assessed and are provided for your own personal practice. Feel free to discuss these with your peers and learning support during work sessions! diff --git a/02_activities/homework/git_moderate.md b/02_activities/homework/git_moderate.md index 2858568..cb7a808 100644 --- a/02_activities/homework/git_moderate.md +++ b/02_activities/homework/git_moderate.md @@ -1,5 +1,7 @@ # Git Basics +**Note**: Homework problems are not assessed and are provided for your own personal practice. Feel free to discuss these with your peers and learning support during work sessions! + ## Tasks ### Task 1 1. Create a new directory named `githomework1`. From 009e2a7950e447d52b30ee307a6e41ebd9662e1f Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Fri, 21 Mar 2025 13:41:41 -0400 Subject: [PATCH 4/9] add ghpages deploy action --- .github/workflows/static.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..2e78fc3 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,43 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './03_instructional_team/githubpages' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From f43a8e25bfe387574b68b3f18cca5f406763ea5d Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Fri, 21 Mar 2025 15:24:58 -0400 Subject: [PATCH 5/9] update explanations in git basics problem set --- 03_instructional_team/githubpages/git_basics.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/03_instructional_team/githubpages/git_basics.yml b/03_instructional_team/githubpages/git_basics.yml index 6db4180..3ac72af 100644 --- a/03_instructional_team/githubpages/git_basics.yml +++ b/03_instructional_team/githubpages/git_basics.yml @@ -291,7 +291,8 @@ problems: description: | You're working on the DSI Shell & Git assignment. 1. You've cloned the repository from GitHub to your local machine. - 1. You've made some changes to the code and committed + 1. You've made some changes to the code + 1. You've staged then committed your changes 1. Now you want to push your changes to the remote repository on GitHub. But you've realized that *instead of cloning your own fork of the repository, you accidentally cloned the original repository.* @@ -314,8 +315,11 @@ problems: 2. `git remote add origin [your fork URL]` - This adds your fork as the new `origin`. 3. `git push origin main` - This pushes your changes to your fork on GitHub. + You may also need to run: + - `git pull origin main` - This fetches the latest changes from your fork and merges them into your local branch. It may not be necessary if there were no changes in your fork since you cloned it. + The other commands are either not necessary or incorrect for this task. - - `git fetch origin` and `git pull origin main` are not needed because you already have the latest changes from the original repository. + - `git fetch origin` is not needed because `git pull` already fetches changes. - `git reclone [your fork URL]` is not a valid command. - `git remote reset origin` is not a valid command. - - `git clone [your fork URL]` would create a new clone of your fork, which is not necessary if you already have a local copy. + - `git clone [your fork URL]` would create a new clone of your fork. Although you could do this, then make all your changes again, it is a very inefficient and error-prone way to solve the problem. From db06de43f90ad34a797796fbe4dd612c377212f3 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Sat, 22 Mar 2025 21:08:47 -0400 Subject: [PATCH 6/9] fix simulated ls directory names --- 03_instructional_team/githubpages/git_basics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03_instructional_team/githubpages/git_basics.yml b/03_instructional_team/githubpages/git_basics.yml index 3ac72af..db1c00c 100644 --- a/03_instructional_team/githubpages/git_basics.yml +++ b/03_instructional_team/githubpages/git_basics.yml @@ -27,7 +27,7 @@ problems: This is your terminal prompt: ```bash user@computer:~$ ls - Desktop Documents Downloads Music Pictures Videos my_project + Desktop/ Documents/ Downloads/ Music/ my_project/ Pictures/ Videos/ user@computer:~$ ``` You might have made a change to a file in the `my_project` directory, but you're not sure. From 14fcbcd3b19303bed4f457f2845a77076021ed02 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Sat, 22 Mar 2025 21:12:22 -0400 Subject: [PATCH 7/9] sync interactive_problems.html with shell --- .../githubpages/interactive_problems.html | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/03_instructional_team/githubpages/interactive_problems.html b/03_instructional_team/githubpages/interactive_problems.html index 464084e..dd34f40 100644 --- a/03_instructional_team/githubpages/interactive_problems.html +++ b/03_instructional_team/githubpages/interactive_problems.html @@ -20,6 +20,10 @@ line-height: 1.5; } + pre { + margin: 2.5rem 0; + } + .problem { margin-bottom: 100px; padding: 10px; @@ -37,6 +41,20 @@ margin-bottom: 20px; } + .multiple-choice-option { + display: inline-block; + } + + .multiple-choice-option p, + .multiple-choice-option pre, + .multiple-choice-option code { + margin: 0; + } + + .multiple-choice-option pre>code { + padding: .2rem .5rem; + } + .freeform-textbox { width: 100%; height: 200px; @@ -90,6 +108,11 @@ color: blue; } + .sol_option code { + background-color: #d1ecf1; + border-color: #4f8a93; + } + .sol_incorrect { text-decoration: line-through; color: red; @@ -170,15 +193,20 @@

problem.options.forEach(({ option, idx }, shuffledIdx) => { const label = document.createElement("label"); + label.style.display = "flex"; + label.style.alignItems = "center"; + const radio = document.createElement("input"); radio.type = "radio"; radio.name = "problem_" + index; radio.value = idx; + radio.style.margin = "0 10px 0 0"; label.appendChild(radio); label.appendChild(document.createTextNode(" ")); - const span = document.createElement("span"); - span.innerHTML = marked.parseInline(option); + const span = document.createElement("div"); + span.classList.add("multiple-choice-option"); + span.innerHTML = marked.parse(option); label.appendChild(span); interactiveElement.appendChild(label); }); @@ -323,7 +351,7 @@

const rightCol = problemDiv.querySelector(".parsons-right"); // Highlight correct items in the left column - const highlight = (item, colour) => { + const highlight = (item, colour, markincorect) => { const this_index = parseInt(item.dataset.index, 10); const sol_order = problem.correct_options.findIndex(option => { if (Array.isArray(option)) { @@ -343,10 +371,12 @@

number.style.right = '5px'; number.style.float = 'right'; item.appendChild(number); + } else if (markincorect) { + item.classList.add("sol_incorrect"); } }; - leftCol.childNodes.forEach(x => highlight(x, "sol_option")); - rightCol.childNodes.forEach(x => highlight(x, "sol_correct")); + leftCol.childNodes.forEach(x => highlight(x, "sol_option", false)); + rightCol.childNodes.forEach(x => highlight(x, "sol_correct", true)); } } else { From fefe3ed919cb0e728e42530eeddd771852634c3b Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Sat, 22 Mar 2025 23:22:52 -0400 Subject: [PATCH 8/9] sync interactive_problems.html with shell --- .../githubpages/interactive_problems.html | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/03_instructional_team/githubpages/interactive_problems.html b/03_instructional_team/githubpages/interactive_problems.html index dd34f40..a63f8d2 100644 --- a/03_instructional_team/githubpages/interactive_problems.html +++ b/03_instructional_team/githubpages/interactive_problems.html @@ -212,17 +212,25 @@

}); } - } else if (problem.questiontype === "parsons") { - interactiveElement = document.createElement("div"); - interactiveElement.className = "parsons-container"; + } else if (problem.questiontype === "parsons") { + let parsonsDragElem = document.createElement("div"); + parsonsDragElem.className = "parsons-container"; // Left column for draggable items const leftCol = document.createElement("div"); leftCol.className = "parsons-left"; + const leftColTitle = document.createElement("b"); + leftColTitle.innerText = "Select from the list below by dragging"; + leftCol.appendChild(leftColTitle); // Right column as drop zone const rightCol = document.createElement("div"); rightCol.className = "parsons-right"; + const rightColTitle = document.createElement("b"); + rightColTitle.innerText = "Drop code here in the correct order"; + rightCol.appendChild(rightColTitle); + + if (problem.options && Array.isArray(problem.options)) { // Store the original index before shuffling problem.options = problem.options.map((option, idx) => ({ option, idx })); @@ -306,8 +314,10 @@

}, { offset: Number.NEGATIVE_INFINITY }).element; } - interactiveElement.appendChild(leftCol); - interactiveElement.appendChild(rightCol); + parsonsDragElem.appendChild(rightCol); + parsonsDragElem.appendChild(leftCol); + + interactiveElement = parsonsDragElem; } if (interactiveElement) { @@ -375,8 +385,8 @@

item.classList.add("sol_incorrect"); } }; - leftCol.childNodes.forEach(x => highlight(x, "sol_option", false)); - rightCol.childNodes.forEach(x => highlight(x, "sol_correct", true)); + leftCol.querySelectorAll('.parsons-item').forEach(x => highlight(x, "sol_option", false)); + rightCol.querySelectorAll('.parsons-item').forEach(x => highlight(x, "sol_correct", true)); } } else { From ac06f1c71ae6bc624433000a45898dbe59463086 Mon Sep 17 00:00:00 2001 From: Simeon Wong Date: Sun, 23 Mar 2025 18:19:51 -0400 Subject: [PATCH 9/9] revert left/right column order --- 03_instructional_team/githubpages/interactive_problems.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03_instructional_team/githubpages/interactive_problems.html b/03_instructional_team/githubpages/interactive_problems.html index a63f8d2..f225972 100644 --- a/03_instructional_team/githubpages/interactive_problems.html +++ b/03_instructional_team/githubpages/interactive_problems.html @@ -314,8 +314,8 @@

}, { offset: Number.NEGATIVE_INFINITY }).element; } - parsonsDragElem.appendChild(rightCol); parsonsDragElem.appendChild(leftCol); + parsonsDragElem.appendChild(rightCol); interactiveElement = parsonsDragElem; }