Skip to content

Commit e3b6c52

Browse files
committed
Initial commit
0 parents  commit e3b6c52

14 files changed

Lines changed: 758 additions & 0 deletions

.devcontainer/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM mcr.microsoft.com/devcontainers/python:1-3.11-bullseye
2+
3+
# Install additional OS packages
4+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y install --no-install-recommends \
6+
sqlite3
7+
8+
# Clean up
9+
RUN apt-get autoremove -y \
10+
&& apt-get clean -y \
11+
&& rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "Python Flask",
3+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
4+
"forwardPorts": [
5+
5000
6+
],
7+
"portsAttributes": {
8+
"5000": {
9+
"label": "Web Preview",
10+
"onAutoForward": "openPreview"
11+
}
12+
},
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"ms-python.python",
17+
"ms-python.vscode-pylance",
18+
"ms-python.black-formatter",
19+
"njpwerner.autodocstring",
20+
"streetsidesoftware.code-spell-checker",
21+
"ms-azuretools.vscode-containers",
22+
"sanaajani.taskrunnercode"
23+
],
24+
"settings": {
25+
"python.defaultInterpreterPath": "/usr/local/bin/python",
26+
"python.formatting.provider": "black",
27+
"editor.formatOnSave": true,
28+
"editor.rulers": [
29+
88
30+
],
31+
"python.analysis.typeCheckingMode": "basic",
32+
"notifications.autoHideWarnings": true,
33+
"notifications.autoHideInfo": true,
34+
"notifications.showErrors": true,
35+
"git.autofetch": true,
36+
"git.autorefresh": true,
37+
"git.fetchOnPull": true,
38+
"extensions.ignoreRecommendations": true
39+
}
40+
}
41+
},
42+
"postCreateCommand": "pip install --upgrade pip",
43+
"postStartCommand": "git config --global safe.directory '*' && python /workspaces/guided-prompt-engineering-junior/.devcontainer/scripts/update_dates.py"
44+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import sqlite3
2+
from datetime import datetime, timedelta
3+
import os
4+
5+
# Set correct path to the database in the instance folder
6+
db_path = os.path.join(
7+
'/workspaces/guided-prompt-engineering-junior/instance', 'habits.db')
8+
9+
# Connect to the database
10+
conn = sqlite3.connect(db_path)
11+
cursor = conn.cursor()
12+
13+
# Get yesterday's date instead of today
14+
today = datetime.now().date()
15+
yesterday = today - timedelta(days=1)
16+
17+
# Get the maximum date from habit_log as reference date
18+
cursor.execute("SELECT MAX(date) FROM habit_log")
19+
max_date_str = cursor.fetchone()[0]
20+
reference_date = datetime.strptime(max_date_str, '%Y-%m-%d').date()
21+
22+
# Calculate days between reference and yesterday
23+
days_difference = (yesterday - reference_date).days
24+
25+
# Get all records from habit_log
26+
cursor.execute("SELECT id, date FROM habit_log")
27+
records = cursor.fetchall()
28+
29+
print(f"Found {len(records)} records to update")
30+
print(
31+
f"Shifting dates by {days_difference} days (from {reference_date} to {yesterday})")
32+
print(f"Using database at: {db_path}")
33+
34+
# Update each record with a new date
35+
for record_id, old_date in records:
36+
# Convert string date to datetime object
37+
old_date_obj = datetime.strptime(old_date, '%Y-%m-%d').date()
38+
39+
# Add the difference in days
40+
new_date_obj = old_date_obj + timedelta(days=days_difference)
41+
42+
# Convert back to string
43+
new_date = new_date_obj.strftime('%Y-%m-%d')
44+
45+
# Update the record
46+
cursor.execute("UPDATE habit_log SET date = ? WHERE id = ?",
47+
(new_date, record_id))
48+
print(f"Updated record {record_id}: {old_date}{new_date}")
49+
50+
# Commit changes and close connection
51+
conn.commit()
52+
conn.close()
53+
54+
print("All dates updated successfully!")

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @kittychiu

.github/copilot-instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Project standards
2+
3+
## GitHub Copilot Chat
4+
5+
- Keep responses and questions simple, talk like a 14 years old
6+
- Be explicit when an action needs to be taken from human side
7+

.vscode/tasks.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Install Dependencies",
6+
"type": "shell",
7+
"command": "pip install -r requirements.txt",
8+
"presentation": {
9+
"reveal": "always"
10+
},
11+
"problemMatcher": []
12+
},
13+
{
14+
"label": "Run Habit Tracking App",
15+
"type": "shell",
16+
"command": "python",
17+
"args": [
18+
"app.py"
19+
],
20+
"problemMatcher": [],
21+
"presentation": {
22+
"reveal": "always"
23+
},
24+
"dependsOn": [
25+
"Install Dependencies"
26+
],
27+
"runOptions": {
28+
"runOn": "folderOpen"
29+
}
30+
}
31+
]
32+
}

README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# 🌟 Build Your Own Habit Tracker App! 🌟
2+
3+
Hey there! In this cool project, you're going to create your very own habit tracking web app. It's going to be AMAZING!
4+
5+
## What You'll Make 🚀
6+
7+
A super awesome web app that helps you track your daily habits - like doing pushups, drinking water, or practicing coding. You'll be able to:
8+
- Add new habits you want to track
9+
- Check them off each day
10+
- See how well you're doing over time
11+
12+
## What You'll Learn 🧠
13+
14+
- How to chat to GitHub Copilot to create things you can use
15+
- How to create app with HTML, CSS, Python and JavaScript
16+
17+
## Getting Started 😎
18+
19+
1. Log into your GitHub user account (or create one if you don't have any)
20+
2. Click the **[Use this template]** button at the top of this page and select **[Create a new repository]**.
21+
22+
3. Fill in the form and click **[Create repository]**
23+
24+
> Wait for a minute to copy the files over and page to load
25+
26+
4. Click the **[Code]** button, then select the **[Codespaces]** tab
27+
5. Click **[Create codespace on main]** button to start your coding workspace
28+
29+
> Wait a minute while your coding space loads (it's like loading a video game!)
30+
31+
6. Once it's ready, you'll see your project files on the left side, and a Habit Tracking app at the centre
32+
7. Open **GitHub Copilot Chat**, and say *"Hello"*
33+
34+
> Wait for GitHub Copilot Chat to load and reply back to you
35+
36+
8. Select **[Agent]** mode and **[Claude Sonnet 3.5]** model, and start chatting with the following prompts!
37+
38+
> Wait till you see a Habit Tracker starter app loaded and Copilot greet you back.
39+
40+
## Guided Prompt Engineering ⚙️
41+
42+
Hey there! Here's what to do with these prompts:
43+
44+
1. Copy each prompt one at a time
45+
2. Paste it into the **GitHub Copilot Chat** window
46+
47+
> Wait for Copilot to give you a response (this might take a few minutes)
48+
49+
3. Follow Copilot's instructions to build your app step by step
50+
4. If you get stuck, ask your instructor for help!
51+
52+
Try these prompts in order - each one builds on the one before:
53+
54+
:bulb: *When you first use GitHub Copilot, your browser might prompt you twice to enable it. Just follow the instructions, and you'll be good to go!*
55+
56+
#### 🗨️ Prompt 1
57+
58+
```
59+
My coach gave me this code, I have no idea what this is, can you help me?
60+
```
61+
62+
#### 🗨️ Prompt 2
63+
64+
```
65+
How do I run it?
66+
```
67+
68+
#### 🗨️ Prompt 3
69+
70+
```
71+
Add a champion badge when I can do the habit for 5 consecutive days
72+
```
73+
74+
#### 🗨️ Prompt 4
75+
76+
```
77+
Give me positive message every day so I can stay motivate, even offline.
78+
```
79+
80+
#### 🗨️ Prompt 5
81+
82+
```
83+
I want to share my progress with friends, can you add the share buttons for Facebook, TikTok and X?
84+
```
85+
86+
#### 🗨️ Prompt 6
87+
88+
```txt
89+
The app looks kinda boring, can you change it with Flintstone theme?
90+
```
91+
92+
## Get Creative :art:
93+
94+
Awesome! Now you've built an app that looks great, works perfectly for tracking habits, and keeps you motivated. What other cool features would you like to add to make it even better?
95+
96+
Here are some examples:
97+
98+
#### 🗨️ Prompt: Add daily reminder
99+
100+
```
101+
I want to download the habit into my calendar with daily reminder
102+
```
103+
104+
#### 🗨️ Prompt: Make a graph
105+
106+
```
107+
I don't like the boring list of check-in dates in the habit page, instead displaying the check-in dates with interesting graph
108+
```
109+
110+
## Need Help? 🆘
111+
112+
If your app disappears or stops running, ask Copilot for help by saying:
113+
114+
```txt
115+
My app has disappeared, help me run the app.
116+
```
117+
118+
Or, if you'd like to fix it yourself, go to **Task Runner** side window and select **Run Habit Tracking App**.
119+
120+
Don't hesitate to ask your instructor or friends if you get stuck—everyone needs help sometimes!
121+

0 commit comments

Comments
 (0)