lucia_adapter_basemain.tsx3 matches
127}
128129function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
130const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
131return {
137}
138139function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
140const { id, ...attributes } = raw;
141return {
145}
146147function escapeName(val: string): string {
148return "`" + val + "`";
149}
pgliteCountermain.tsx1 match
18})();
1920export default async function(req: Request): Promise<Response> {
21await init;
22await pg.query(`
11import { email } from "https://esm.town/v/std/email?v=13";
1213export default async function (interval: Interval) {
14const bookingInfo = await resyBot( {
15slug: 'amaro-bar',
18const ValTownOfficeDeviceId = "CD6F3A810848";
1920async function switchbotRequest(path, args) {
21const token = Deno.env.get("SWITCHBOT_TOKEN");
22const secret = Deno.env.get("SWITCHBOT_KEY");
42}
4344function botPress(device) {
45return switchbotRequest(`v1.1/devices/${device}/commands`, {
46method: "POST",
18const ValTownOfficeDeviceId = "CD6F3A810848";
1920async function switchbotRequest(path, args) {
21const token = Deno.env.get("SWITCHBOT_TOKEN");
22const secret = Deno.env.get("SWITCHBOT_KEY");
42}
4344function botPress(device) {
45return switchbotRequest(`v1.1/devices/${device}/commands`, {
46method: "POST",
whenfilmedmain.tsx7 matches
13}
1415async function fetchRandomMovies() {
16const currentYear = new Date().getFullYear()
17const movies = []
35}
3637function generateQuizHTML(movies, uuid) {
38const currentYear = new Date().getFullYear()
39return `
52</style>
53<script>
54function updateInputs(index, value) {
55document.getElementById('guess' + index).value = value;
56document.getElementById('guessInput' + index).value = value;
91}
9293function calculateScore(movies, guesses) {
94return movies.reduce((score, movie, index) => {
95const actualYear = new Date(movie.release_date).getFullYear()
102}
103104function generateResultsHTML(movies, guesses, score) {
105return `
106<html>
152}
153154function generateAllGuessesHTML(allGuesses) {
155return `
156<html>
198}
199200export default async function main(req: Request): Promise<Response> {
201const { author, name } = extractValInfo(import.meta.url)
202const guessesKey = `${author}.${name}.guesses`
hardwarebingomain.tsx1 match
97if (typeof document !== "undefined") { createRoot(document.getElementById("root")).render(<App />); }
9899export default async function(req: Request): Promise<Response> {
100return new Response(
101renderToString(
12* The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13* Can be a single string, IAddress object, or an array of strings/IAddress objects.
14* @default the email of the logged user calling this function.
15*/
16to?: (IAddress | string)[] | IAddress | string;
azureCheetahmain.tsx14 matches
16import { renderToString } from "npm:react-dom/server";
1718export default function(
19{ tempValsParentFolderId }: { tempValsParentFolderId: string },
20) {
38the simplest way to achieve the goal, though you can add some inline comments to explain your
39reasoning (not for every line, but for major groups of lines). Don't use any environment variables
40unless strictly necessary, for example use APIs that don't require a key, prefer internal function
41imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
42functions where possible. Unless specified, don't add error handling,
43make sure that errors bubble up to the caller.
44Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
51\`\`\`
52There should be no comments like "more content here", it should be complete and directly runnable.
53The val should create a "export default async function main" which is the main function that gets
54executed on every HTTP request.
55`.replace("\n", " ");
5657// Your response should start with \`\`\`ts and end with \`\`\`.
58// The val should create a "export default async function main() {" which
59// is the main function that gets executed, without any arguments. Don't return a Response object,
60// just return a plain Javascript object, array, or string.
6198const writer = writable.getWriter();
99const textEncoder = new TextEncoder();
100function write(text) {
101writer.write(textEncoder.encode(text));
102}
174</div>
175<script>
176function updateValName(valName) {
177const valUrl = valName ? \`https://val.town/v/${username}/\${valName}\` : "";
178const previewUrl = valName ? \`https://${username}-\${valName}.web.val.run\` : "";
182document.getElementById('open-link').href = previewUrl;
183}
184function saveVal() {
185if (window.codeMirrorEditor) {
186document.getElementById("save-icon").classList.remove("hidden");
202return false;
203})
204function openTab(tab) {
205const tabButtonCode = document.getElementById("tab-button-code");
206const tabButtonPreview = document.getElementById("tab-button-preview");
222}
223}
224function toggleTab() {
225openTab(document.getElementById("tab-panel-code").style.visibility === "visible" ? "preview" : "code");
226}
281(() => {
282const scrollingElement = document.getElementById("conversation-container");
283const callback = function (mutationsList, observer) {
284scrollingElement.scrollTo({ left: 0, top: scrollingElement.scrollHeight, behavior: "instant" });
285};
390window.setCodeMirrorContent({ doc: '', old: ''});
391let fullStr = "";
392window.addToken = function(str) {
393fullStr += str;
394const code = fullStr.replaceAll("\`\`\`ts\\n", "").replaceAll("\`\`\`", "").replace(/^ts\\n/, '');
429},
430);
431(async function() {
432try {
433await sleep(300);
16import { renderToString } from "npm:react-dom/server";
1718export default function(
19{ tempValsParentFolderId }: { tempValsParentFolderId: string },
20) {
38the simplest way to achieve the goal, though you can add some inline comments to explain your
39reasoning (not for every line, but for major groups of lines). Don't use any environment variables
40unless strictly necessary, for example use APIs that don't require a key, prefer internal function
41imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
42functions where possible. Unless specified, don't add error handling,
43make sure that errors bubble up to the caller.
44Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
51\`\`\`
52There should be no comments like "more content here", it should be complete and directly runnable.
53The val should create a "export default async function main" which is the main function that gets
54executed on every HTTP request.
55`.replace("\n", " ");
5657// Your response should start with \`\`\`ts and end with \`\`\`.
58// The val should create a "export default async function main() {" which
59// is the main function that gets executed, without any arguments. Don't return a Response object,
60// just return a plain Javascript object, array, or string.
6198const writer = writable.getWriter();
99const textEncoder = new TextEncoder();
100function write(text) {
101writer.write(textEncoder.encode(text));
102}
174</div>
175<script>
176function updateValName(valName) {
177const valUrl = valName ? \`https://val.town/v/${username}/\${valName}\` : "";
178const previewUrl = valName ? \`https://${username}-\${valName}.web.val.run\` : "";
182document.getElementById('open-link').href = previewUrl;
183}
184function saveVal() {
185if (window.codeMirrorEditor) {
186document.getElementById("save-icon").classList.remove("hidden");
202return false;
203})
204function openTab(tab) {
205const tabButtonCode = document.getElementById("tab-button-code");
206const tabButtonPreview = document.getElementById("tab-button-preview");
222}
223}
224function toggleTab() {
225openTab(document.getElementById("tab-panel-code").style.visibility === "visible" ? "preview" : "code");
226}
281(() => {
282const scrollingElement = document.getElementById("conversation-container");
283const callback = function (mutationsList, observer) {
284scrollingElement.scrollTo({ left: 0, top: scrollingElement.scrollHeight, behavior: "instant" });
285};
390window.setCodeMirrorContent({ doc: '', old: ''});
391let fullStr = "";
392window.addToken = function(str) {
393fullStr += str;
394const code = fullStr.replaceAll("\`\`\`ts\\n", "").replaceAll("\`\`\`", "").replace(/^ts\\n/, '');
429},
430);
431(async function() {
432try {
433await sleep(300);