All checks were successful
Docker / build-and-push (push) Successful in 37s
8 more entries (16 total, up from 8): three more code snippets across delve-term/stash/goonk for variety, plus five real lore/flavor text fragments -- two from adventure's Chronicle of the Keepers (English) and three from djupet's event log (Swedish, on purpose -- genuinely different character set, and it's real shipped content, not filler). Added a `type` field (code/lore) to every entry for future use (could filter by type later) and updated the header/help-modal copy to stop saying "code" exclusively now that it isn't. Verified via simulated typing: a full Swedish snippet (öäå included) types and finishes correctly with 100% accuracy, and a lore snippet renders and completes the same as any code one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
115 lines
6.7 KiB
JSON
115 lines
6.7 KiB
JSON
[
|
|
{
|
|
"repo": "delve-term",
|
|
"file": "game/combat.go",
|
|
"lang": "go",
|
|
"type": "code",
|
|
"code": "func withThe(name string) string {\n\tif strings.HasPrefix(name, \"the \") {\n\t\treturn name\n\t}\n\treturn \"the \" + name\n}"
|
|
},
|
|
{
|
|
"repo": "delve-term",
|
|
"file": "game/graves.go",
|
|
"lang": "go",
|
|
"type": "code",
|
|
"code": "func RandomGraveNear(floor, spread int) *Grave {\n\tgraveMu.Lock()\n\tdefer graveMu.Unlock()\n\tvar candidates []Grave\n\tfor _, g := range graves {\n\t\td := g.Floor - floor\n\t\tif d < 0 {\n\t\t\td = -d\n\t\t}\n\t\tif d <= spread {\n\t\t\tcandidates = append(candidates, g)\n\t\t}\n\t}\n\tif len(candidates) == 0 {\n\t\treturn nil\n\t}\n\treturn &candidates[rand.Intn(len(candidates))]\n}"
|
|
},
|
|
{
|
|
"repo": "delve-term",
|
|
"file": "game/view.go",
|
|
"lang": "go",
|
|
"type": "code",
|
|
"code": "func hpBar(cur, max int) string {\n\tstyle := hpStyle\n\tif cur <= max/4 {\n\t\tstyle = hpLowStyle\n\t}\n\tconst width = 20\n\tfilled := 0\n\tif max > 0 {\n\t\tfilled = cur * width / max\n\t}\n\tif filled < 0 {\n\t\tfilled = 0\n\t}\n\tbar := strings.Repeat(\"#\", filled) + strings.Repeat(\"-\", width-filled)\n\treturn style.Render(fmt.Sprintf(\"[%s] %d/%d\", bar, cur, max))\n}"
|
|
},
|
|
{
|
|
"repo": "flit",
|
|
"file": "cli/cmd/flit/main.go",
|
|
"lang": "go",
|
|
"type": "code",
|
|
"code": "func decodeInvite(s string) (*invite, error) {\n\tconst prefix = \"flit:\"\n\tif len(s) < len(prefix) || s[:len(prefix)] != prefix {\n\t\treturn nil, fmt.Errorf(\"not a flit invite\")\n\t}\n\traw, err := base64.RawURLEncoding.DecodeString(s[len(prefix):])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar inv invite\n\tif err := json.Unmarshal(raw, &inv); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &inv, nil\n}"
|
|
},
|
|
{
|
|
"repo": "wisp",
|
|
"file": "client/src/crypto.ts",
|
|
"lang": "ts",
|
|
"type": "code",
|
|
"code": "function concat(...parts: Uint8Array[]): Uint8Array {\n const total = parts.reduce((n, p) => n + p.length, 0)\n const out = new Uint8Array(total)\n let offset = 0\n for (const p of parts) {\n out.set(p, offset)\n offset += p.length\n }\n return out\n}"
|
|
},
|
|
{
|
|
"repo": "stash",
|
|
"file": "src/server/db.ts",
|
|
"lang": "ts",
|
|
"type": "code",
|
|
"code": "export function deleteArticle(id: number): boolean {\n const result = db.prepare('DELETE FROM articles WHERE id = ?').run(id);\n return result.changes > 0;\n}\n\nexport function isValidToken(token: string): boolean {\n const row = db.prepare('SELECT 1 FROM tokens WHERE token = ?').get(token);\n return !!row;\n}"
|
|
},
|
|
{
|
|
"repo": "stash",
|
|
"file": "extension/background.js",
|
|
"lang": "js",
|
|
"type": "code",
|
|
"code": "function notify(title, message) {\n chrome.notifications.create({\n type: 'basic',\n iconUrl: 'data:image/svg+xml;base64,' + btoa('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\"><rect width=\"48\" height=\"48\" rx=\"8\" fill=\"#0a5\"/></svg>'),\n title,\n message,\n });\n}"
|
|
},
|
|
{
|
|
"repo": "keep",
|
|
"file": "src/server/db.ts",
|
|
"lang": "ts",
|
|
"type": "code",
|
|
"code": "export function hasGrant(vaultKey: string, recipientId: string): boolean {\n return !!getGrant(vaultKey, recipientId);\n}\n\nexport function hasWriteGrant(vaultKey: string, recipientId: string): boolean {\n const grant = getGrant(vaultKey, recipientId);\n return !!grant && grant.canWrite;\n}"
|
|
},
|
|
{
|
|
"repo": "goonk",
|
|
"file": "api/routes/lastfm.mjs",
|
|
"lang": "js",
|
|
"type": "code",
|
|
"code": "router.get('/top-artists', async (req, res) => {\n const period = req.query.period || '7day';\n const limit = Math.min(Number(req.query.limit) || 10, 50);\n try {\n const data = await cached(`top-artists:${period}:${limit}`, CACHE_TTL_MS, () =>\n lfm('user.gettopartists', { period, limit })\n );\n res.json(data.topartists?.artist ?? []);\n } catch (e) {\n res.status(502).json({ error: e.message });\n }\n});"
|
|
},
|
|
{
|
|
"repo": "goonk",
|
|
"file": "api/routes/gitea.mjs",
|
|
"lang": "js",
|
|
"type": "code",
|
|
"code": "router.get('/toprepos', async (_req, res) => {\n try {\n if (repoCache && Date.now() - repoCache.ts < CACHE_TTL_MS) {\n return res.json(repoCache.data);\n }\n const upstream = await fetch(`${BASE}/api/v1/users/${USER}/repos?limit=50`);\n if (!upstream.ok) return res.status(502).json({ error: 'upstream error' });\n const repos = await upstream.json();\n const data = repos\n .filter(r => !r.archived && !r.fork)\n .sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at))\n .slice(0, 6)\n .map(r => ({ name: r.name, url: r.html_url, updatedAt: r.updated_at }));\n repoCache = { data, ts: Date.now() };\n res.json(data);\n } catch (err) {\n res.status(500).json({ error: String(err) });\n }\n});"
|
|
},
|
|
{
|
|
"repo": "goonk",
|
|
"file": "public/scripts/easter-eggs.js",
|
|
"lang": "js",
|
|
"type": "code",
|
|
"code": "const typedWordAchievements = ['sudo', 'vim', 'emacs', 'gravity'];\nif (typedWordAchievements.includes(achievementKey.toLowerCase()) && !unlocked.includes('console')) {\n setTimeout(() => unlockAchievement('CONSOLE'), 1000);\n}"
|
|
},
|
|
{
|
|
"repo": "adventure",
|
|
"file": "chronicle-3: The Last Watch",
|
|
"lang": "en",
|
|
"type": "lore",
|
|
"code": "Maret fell at the fourth gate. Thessen did not return from the lower passage. I have not heard Voss in three days.\n\nI keep the watch alone.\n\nThe Heart is no longer dormant. I can feel it thinking through the walls -- old and patient and vast, the way a mountain is patient. It is testing the light. Each morning the Sunstone seems a little dimmer.\n\nI do not believe I can hold this post much longer. I am leaving notes for whoever comes after. I hope they are better prepared than we were.\n\n-- Aldric"
|
|
},
|
|
{
|
|
"repo": "adventure",
|
|
"file": "scroll-06: Mira Voss",
|
|
"lang": "en",
|
|
"type": "lore",
|
|
"code": "My name is Mira Voss. I reached level eight. If you find this, it means I did not come back. The wraiths cannot be killed, only avoided."
|
|
},
|
|
{
|
|
"repo": "djupet",
|
|
"file": "events.ts",
|
|
"lang": "sv",
|
|
"type": "lore",
|
|
"code": "Det finns en anledning till att alla änder vid Ribersborg vänder sig mot Turning Torso i ett nästan tillbedjande tillstånd. De anar mer än oss."
|
|
},
|
|
{
|
|
"repo": "djupet",
|
|
"file": "events.ts",
|
|
"lang": "sv",
|
|
"type": "lore",
|
|
"code": "Skatteverket har skickat ett brev. De undrar om vår religiösa verksamhet är momsbefriad. Syster Hassan svarar dem med ett 47 sidor långt svar. De hör inte av sig igen."
|
|
},
|
|
{
|
|
"repo": "djupet",
|
|
"file": "events.ts",
|
|
"lang": "sv",
|
|
"type": "lore",
|
|
"code": "Ett IKEA-bord av modell LACK har börjat blöda svart vätska. Vi har lagt en matta över det. Det hjälper inte men det ser snyggare ut."
|
|
}
|
|
]
|