Update index.html
Browse files- index.html +24 -16
index.html
CHANGED
|
@@ -107,51 +107,59 @@
|
|
| 107 |
{
|
| 108 |
title: 'Parse Apache logs (Python)',
|
| 109 |
sys: 'You are a senior coding assistant. Keep answers concise and show tested code.',
|
| 110 |
-
prompt:
|
| 111 |
},
|
| 112 |
{
|
| 113 |
title: 'Refactor callbacks → async/await (JS)',
|
| 114 |
sys: 'You are a pragmatic JS refactoring assistant.',
|
| 115 |
-
prompt:
|
| 116 |
-
const fs = require(
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
},
|
| 119 |
{
|
| 120 |
title: 'Cohort retention SQL (Postgres)',
|
| 121 |
sys: 'You are a data engineer.',
|
| 122 |
-
prompt:
|
| 123 |
},
|
| 124 |
{
|
| 125 |
title: 'Unit tests with pytest',
|
| 126 |
sys: 'You are a Python testing expert.',
|
| 127 |
-
prompt:
|
| 128 |
},
|
| 129 |
{
|
| 130 |
title: 'Explain code step by step',
|
| 131 |
sys: 'Be a clear explainer for junior developers.',
|
| 132 |
-
prompt:
|
| 133 |
from collections import defaultdict
|
|
|
|
| 134 |
def f(nums):
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
},
|
| 141 |
{
|
| 142 |
title: 'Regex with explanation',
|
| 143 |
sys: 'You write readable regex with comments.',
|
| 144 |
-
prompt:
|
| 145 |
},
|
| 146 |
{
|
| 147 |
title: 'Document a Go function',
|
| 148 |
sys: 'You are a Go reviewer.',
|
| 149 |
-
prompt:
|
| 150 |
},
|
| 151 |
{
|
| 152 |
title: 'GitHub Actions CI',
|
| 153 |
sys: 'You are a DevOps assistant.',
|
| 154 |
-
prompt:
|
| 155 |
}
|
| 156 |
];
|
| 157 |
|
|
@@ -175,7 +183,7 @@ def f(nums):
|
|
| 175 |
|
| 176 |
// ================= Utils =================
|
| 177 |
function log(...a){ const s=a.map(x=>typeof x==='string'?x:JSON.stringify(x)).join(' ');
|
| 178 |
-
logDiv.textContent+=s+'
|
| 179 |
'; logDiv.scrollTop=logDiv.scrollHeight; console.log('[LOG]',...a); }
|
| 180 |
function chip(kind,text){ statusChip.className='chip '+(kind||''); statusChip.textContent=text; statusChip.style.display='inline-flex'; }
|
| 181 |
function clearChip(){ statusChip.style.display='none'; }
|
|
|
|
| 107 |
{
|
| 108 |
title: 'Parse Apache logs (Python)',
|
| 109 |
sys: 'You are a senior coding assistant. Keep answers concise and show tested code.',
|
| 110 |
+
prompt: `Write a Python function parse_log(line: str) that parses Apache combined log format into a dict with keys ip, time, method, path, status, bytes, referrer, ua. Include robust regex, timezone handling, and 5 pytest unit tests.`
|
| 111 |
},
|
| 112 |
{
|
| 113 |
title: 'Refactor callbacks → async/await (JS)',
|
| 114 |
sys: 'You are a pragmatic JS refactoring assistant.',
|
| 115 |
+
prompt: `Refactor this Node.js callback code to async/await with proper error handling and backpressure using streams:
|
| 116 |
+
const fs = require('fs');
|
| 117 |
+
fs.readFile('in.txt', (e, d) => {
|
| 118 |
+
if (e) throw e;
|
| 119 |
+
fs.writeFile('out.txt', d.toString().toUpperCase(), err => {
|
| 120 |
+
if (err) throw err;
|
| 121 |
+
console.log('done');
|
| 122 |
+
});
|
| 123 |
+
});
|
| 124 |
+
Provide a short explanation.`
|
| 125 |
},
|
| 126 |
{
|
| 127 |
title: 'Cohort retention SQL (Postgres)',
|
| 128 |
sys: 'You are a data engineer.',
|
| 129 |
+
prompt: `Given events(user_id, event_time, event_name) with sign_up and active events, write a SQL that computes weekly user retention (cohorted by signup week) as a pivoted table. Assume UTC timestamps. Explain indexes briefly.`
|
| 130 |
},
|
| 131 |
{
|
| 132 |
title: 'Unit tests with pytest',
|
| 133 |
sys: 'You are a Python testing expert.',
|
| 134 |
+
prompt: `Generate pytest tests for a function normalize_phone(s: str) that returns E.164 format or raises ValueError. Cover edge cases and property tests with hypothesis.`
|
| 135 |
},
|
| 136 |
{
|
| 137 |
title: 'Explain code step by step',
|
| 138 |
sys: 'Be a clear explainer for junior developers.',
|
| 139 |
+
prompt: `Explain the following code step by step, then suggest two improvements for readability and performance:
|
| 140 |
from collections import defaultdict
|
| 141 |
+
|
| 142 |
def f(nums):
|
| 143 |
+
d = defaultdict(int)
|
| 144 |
+
for x in nums:
|
| 145 |
+
d[x] += 1
|
| 146 |
+
m = max(d.values())
|
| 147 |
+
return [k for k, v in d.items() if v == m]`
|
| 148 |
},
|
| 149 |
{
|
| 150 |
title: 'Regex with explanation',
|
| 151 |
sys: 'You write readable regex with comments.',
|
| 152 |
+
prompt: `Write a single regex that matches a valid IPv4 or IPv6 address. Provide a commented, multi-line version and a short, single-line version, plus examples of matches and non-matches.`
|
| 153 |
},
|
| 154 |
{
|
| 155 |
title: 'Document a Go function',
|
| 156 |
sys: 'You are a Go reviewer.',
|
| 157 |
+
prompt: `Write a Go doc comment and improve the signature for a function that merges two sorted slices of ints and returns a deduplicated sorted slice. Provide a fully working example.`
|
| 158 |
},
|
| 159 |
{
|
| 160 |
title: 'GitHub Actions CI',
|
| 161 |
sys: 'You are a DevOps assistant.',
|
| 162 |
+
prompt: `Create a GitHub Actions workflow (YAML) that runs Python tests on 3.11, caches pip, runs flake8 + pytest, and uploads coverage to Codecov with secrets.CODECOV_TOKEN.`
|
| 163 |
}
|
| 164 |
];
|
| 165 |
|
|
|
|
| 183 |
|
| 184 |
// ================= Utils =================
|
| 185 |
function log(...a){ const s=a.map(x=>typeof x==='string'?x:JSON.stringify(x)).join(' ');
|
| 186 |
+
logDiv.textContent += s + '
|
| 187 |
'; logDiv.scrollTop=logDiv.scrollHeight; console.log('[LOG]',...a); }
|
| 188 |
function chip(kind,text){ statusChip.className='chip '+(kind||''); statusChip.textContent=text; statusChip.style.display='inline-flex'; }
|
| 189 |
function clearChip(){ statusChip.style.display='none'; }
|