Search
![ageo avatar](https://images.clerk.dev/oauth_github/img_2QvbMOiLJC74uuDeHlpdLLqMVwd.jpeg)
myApi
@ageo
An interactive, runnable TypeScript val by ageo
Script
export function myApi(name) {
return "hi " + name;
![saolsen avatar](https://images.clerk.dev/oauth_github/img_2QtXHzN3gDPhKsBOvKsst8LTxC5.png)
traced_http_val
@saolsen
An interactive, runnable TypeScript val by saolsen
HTTP
new Promise((resolve) => setTimeout(resolve, delay));
function _foo(x: number) {
console.log(x);
const foo = traced("foo", _foo);
function _throw() {
throw new Error("errr");
await sleep(100);
async function afn(x: number): Promise<number> {
return x;
const tafn = traced("afn", afn);
async function handler(request: Request): Promise<Response> {
await tracer.startActiveSpan("sub-span", async (span) => {
![saip009 avatar](https://images.clerk.dev/oauth_github/img_2TRWBNDDfxMfHh0NvURHbc6jn6W.jpeg)
myApi
@saip009
An interactive, runnable TypeScript val by saip009
Script
export function myApi(name) {
return "hi " + name;
myApi
@alxndr
An interactive, runnable TypeScript val by alxndr
Script
export function myApi(name) {
return "hi " + name;
myApi
@gaylonalfano
An interactive, runnable TypeScript val by gaylonalfano
Script
export function myApi(name) {
return "hi " + name;
val_48vpEOElB4
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_48vpEOElB4(req) {
try {
// Execute the code directly and capture its result
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
nicoFunctionScript
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
const a = (x) => x + 1;
const b = (y) => a(y);
export const nicoFunctionScript = [a(5), b(5)];
![sbecker avatar](https://images.clerk.dev/oauth_github/img_2RorvOpCQsnRHdyM4eDSAfAQCx4.png)
myFoo
@sbecker
An interactive, runnable TypeScript val by sbecker
Script
import { myApi } from "https://esm.town/v/sbecker/myApi";
export function myFoo(name) {
console.email("Testing email from val town " + name);
return "hello --- " + myApi("x") + " name: " + name;
val_dDDB0hjTSh
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_dDDB0hjTSh(req) {
try {
const body = await req.text();
// Create a function from the provided code and execute it
const userFunction = async () => {
const findPrimes = (n) => {
// Execute and capture the result
const result = await userFunction();
// Handle different types of results
myApi
@callumk7
An interactive, runnable TypeScript val by callumk7
Script
export function myApi(name) {
return "hi " + name;
val_lTAm4Rlhnf
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_lTAm4Rlhnf(req) {
try {
// Execute the code directly and capture its result
myApi
@fsawakta
An interactive, runnable TypeScript val by fsawakta
HTTP
export function myApi(name) {
return "hi " + name;
![saolsen avatar](https://images.clerk.dev/oauth_github/img_2QtXHzN3gDPhKsBOvKsst8LTxC5.png)
clerk_hono_poc
@saolsen
Sloppy but it's a working POC. Clerk key would be shared by all vals though, probably annoying since you'd have to configure each URL in clerk. Could be fine though. The CLERK_JWT_KEY is a hack where I took the pem and replaced all the newlines with '|' so I could set it as an env var and then turn them back to newlines.
HTTP
const app = new Hono();
function main(children: Child): JSX.Element {
return (
</main>
function page(children: Child): JSX.Element {
return (
<script>
async function loadClerk() {
await window.Clerk.load()
slackbot
@begoon
A simple Slack chat bot prototype able to reply to mentions, channel messages containing keywords, add reactions and act on the slash commands.
HTTP
const SLACK_SIGNING_SECRET = env.get("SLACK_SIGNING_SECRET");
const SLACK_VERIFICATION_TOKEN = env.get("SLACK_VERIFICATION_TOKEN");
async function message(channel: string, text: string, thread_ts?: string) {
return await fetchJSON(
"https://slack.com/api/chat.postMessage",
method: "POST",
body: JSON.stringify({ channel, text, thread_ts }),
async function reaction(channel: string, timestamp: string, name: string = "thumbsup") {
return await fetchJSON(
"https://slack.com/api/reactions.add",
indexValsBlobs
@janpaul123
Part of Val Town Semantic Search . Generates OpenAI embeddings for all public vals, and stores them in Val Town's blob storage . Create a new metadata object. Also has support for getting the previous metadata and only adding new vals, but that's currently disabled. Get all val names from the database of public vals , made by Achille Lacoin . Put val names in batches. Vals in the same batch will have their embeddings stored in the same blob, at different offsets. Iterate through all each batch, get code for all the vals, get embeddings from OpenAI, and store the result in a blob. When finished, save the metadata JSON to its own blob. Can now be searched using janpaul123/semanticSearchBlobs .
Script
*Part of [Val Town Semantic Search](https://www.val.town/v/janpaul123/valtownsemanticsearch).*
Generates OpenAI embeddings for all public vals, and stores them in Val Town's [blob storage](https://docs.val.town/std/blob/).
- Create a new metadata object. Also has support for getting the previous metadata and only adding new vals, but that's currently disabled.
- Put val names in batches. Vals in the same batch will have their embeddings stored in the same blob, at different offsets.
- Iterate through all each batch, get code for all the vals, get embeddings from OpenAI, and store the result in a blob.
- When finished, save the metadata JSON to its own blob.
import { blob } from "https://esm.town/v/std/blob";
import OpenAI from "npm:openai";
import { truncateMessage } from "npm:openai-tokens";
const dimensions = 1536;
const existingEmbeddingsIds = new Set(Object.keys(allValsBlobEmbeddingsMeta));
function idForVal(val: any): string {
return `${val.author_username}!!${val.name}!!${val.version}`;
...Object.values(allValsBlobEmbeddingsMeta).map((item: any) => item.batchDataIndex + 1),
const openai = new OpenAI();
for (const newValsBatch of newValsBatches) {
const code = getValCode(val);
const embedding = await openai.embeddings.create({
model: "text-embedding-3-small",