All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

nuno

Joined 6 months ago

Recently created
Least recently created
Recently updated
Least recently updated
All gists 584

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 resetWeek(): void {
2 // Fire the weekly reset on Monday 00:00 (WRank reset) (UTC+2 = Sunday 22:00)
3 const nowUtcNoon = new Date();
4 nowUtcNoon.setUTCHours(12, 0, 0, 0);
5
6 const newWeekKey = WRank.weekKey(nowUtcNoon);
7 const prevWeekKey = WRank.weekKey(new Date(nowUtcNoon.getTime() - 7 * 24 * 60 * 60 * 1000));
8 const prevWeek = _data[prevWeekKey];
9 const newWeek = ensureWeek(newWeekKey);

nuno / wrank.ts

0 likes
0 forks
1 files
Last active 3 months ago
1 import { UserKey, CharName, Nation, ClassKey, Character, CLASSES } from "@types";
2 import { Config } from "@systems/config";
3 import { Bringer } from "@systems/bringer";
4 import { Nations } from "@systems/nations";
5 import { Store } from "@systems/store";
6 import { Paths } from "@paths";
7 import { TGKey } from "@systems/tg-key";
8 import { Runtime } from "@systems/runtime";
9 import { Logger } from "@systems/logger";
10 import { CharacterRegistry } from "@registry/character-registry";

nuno / set.ts

0 likes
0 forks
1 files
Last active 3 months ago
1 import { ChatInputCommandInteraction } from "discord.js";
2 import { Config } from "@systems/config";
3 import { resolveUser, hasOfficerRole } from "@systems/users";
4 import { Score } from "@systems/score";
5 import { detectSlot, normalizeSlot } from "@systems/scores";
6 import { getEffectiveCharacter } from "@systems/borrow";
7 import { replyAndDelete } from "@utils";
8 import { Emoji } from "@systems/emojis";
9 import { Discord } from "@discord";
10 import { User } from "@systems/users";

nuno / modals.ts

0 likes
0 forks
1 files
Last active 3 months ago
1 import {
2 ModalSubmitInteraction,
3 ModalBuilder,
4 TextInputBuilder,
5 TextInputStyle,
6 ActionRowBuilder,
7 } from "discord.js";
8 import { resolveUser } from "@systems/users";
9 import { getEffectiveCharacter } from "@systems/borrow";
10 import { score } from "@subcommands/score/submitCore";

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 "dey",
2 "zephyr"
3 ],
4 "2026-06-15-20": [],
5 "2026-06-16-20": [],
6 "2026-06-17-20": [],
7 "2026-06-18-20": [],
8 "2026-06-19-20": [],
9 "2026-06-20-20": [],
10 "2026-06-21-20": [

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 import { ChatInputCommandInteraction } from "discord.js";
2 import { Config } from "@systems/config";
3 import { resolveUser, hasOfficerRole } from "@systems/users";
4 import { submitScore, detectSlot, normalizeSlot } from "@systems/scores";
5 import { getEffectiveCharacter } from "@systems/borrow";
6 import { replyAndDelete } from "@utils";
7 import { Emoji } from "@systems/emojis";
8 import { Discord } from "@discord";
9 import { User } from "@systems/users";
10 import { Logger } from "@systems/logger";

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 /**
2 * Submit a score for a character.
3 * Handles W.Rank snapshot at submission time.
4 */
5 async submit({ character, borrowedFrom, pts, k, d, atk, def, heal, slot, submittedByOfficer }: {
6 character: Character;
7 borrowedFrom?: UserKey;
8 pts: number;
9 k?: number;
10 d?: number;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 function formatRow(
2 row: ResultRow,
3 context: NationContext,
4 allNames: string[],
5 allScores: string[],
6 allKds: string[],
7 allAtks: string[],
8 allDefs: string[]
9 ): string {
10 const char = row.character;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 function buildRows(historyKey: TGKey): ResultRow[] {
2 const { slot, date } = TGKey.parse(historyKey);
3 let players: UserKey[] = Attendance.players(historyKey);
4
5 if (players.length === 0) {
6 const history = Store.read<{ scores: TGScore[] }>(TGKey.toHistoryPath(historyKey));
7 if (history?.scores) {
8 players = [...new Set(history.scores.map((s: TGScore) => s.playedBy ?? s.userKey))];
9 }
10 }

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 4 months ago
1 import fs from "fs";
2 import path from "path";
3 import { TGResult, TGScore, Nation } from "../types";
4 import { Nations } from "@systems/nations";
5 import { Store } from "@systems/store";
6 import { Paths } from "@helpers/paths";
7 import { TGKey } from "@systems/tg-key";
8 import { Logger } from "@systems/logger";
9 const log = Logger.for("upsert-score");
Newer Older

Powered by Opengist ⋅ Load: 94ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub