1export function quine() {
2 return `${quine}`;
3}
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function getMe(): Promise<{ username: string; id: string; profileImageUrl; bio: string }> {
4 return fetchJSON("https://api.val.town/v1/me", {
5 headers: {
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`
1export function myApi(name) {
2 return "hi " + name;
3}
3import { DataType, Float64, Int32, Table, tableToIPC, Utf8, vectorFromArray } from "npm:apache-arrow";
4
5// Function to map SQLite data types to Apache Arrow data types
6function sqliteTypeToArrowType(sqliteType: string): DataType {
7 switch (sqliteType.toUpperCase()) {
8 case "INTEGER":
20export type SQLiteTableExportFormat = "json" | "arrowIPC";
21
22export async function exportSQLiteTable(
23 tableName: string,
24 format: SQLiteTableExportFormat,
10import { exportSQLiteTable, SQLiteTableExportFormat } from "https://esm.town/v/rlesser/sqliteTableExportUtils";
11
12export default async function(req: Request): Promise<Response> {
13 const tableName = new URL(req.url).searchParams.get("table");
14 if (!tableName) {
9
10// Copied from https://github.com/Will-Howard/manifolio/blob/master/manifolio-ui/lib/calculate.ts
11function calculateNaiveKellyBet({
12 marketProb,
13 estimatedProb,
34}
35
36async function getMarket(slug: string) {
37 const res = await fetch(`https://api.manifold.markets/v0/slug/${slug}`);
38
45}
46
47export default async function(req: Request): Promise<Response> {
48 const searchParams = new URL(req.url).searchParams;
49 const params = paramsSchema.parse(Object.fromEntries(searchParams.entries())) as z.infer<typeof paramsSchema>;
17[🔬️ inspect ASP JWT token](https://vladimyr-aspe_inspector.web.val.run/aspe:keyoxide.org:TOICV3SYXNJP7E4P5AOK5DHW44)
18
19Badge with new ASPE URI (not functional yet ⚠️):
20[](https://keyoxide.org/aspe:fe7b75c54b95ac019dd48fbefe8d654af383cbfe)
21
11});
12
13async function getKnownThreads() {
14 const result = await db.select().from(threadsTbl);
15 return result.reduce((r, { id, last_message_id }) => {
19}
20
21async function getNewThreads() {
22 const resp = await fetch(`https://discord.com/api/guilds/${guild}/threads/active`, {
23 headers: {
34}
35
36export async function getThreadsActivity(
37 token: string,
38 guild: string,
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
4
5export default async function(ctx: BrowserContext<{ author: string; name: string }>) {
6 const { author, name } = ctx.params;
7 const title = `@${author}/${name}`;
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.