Search
newCerebrasModelAlert
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Cron
import { email } from "https://esm.town/v/std/email?v=13";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export default async function(interval: Interval) {
const historicalModels = await blob.getJSON("cerebras-models.json");
const currentModels = await fetchJSON("https://api.cerebras.ai/v1/models", {
myApi
@runarorama
An interactive, runnable TypeScript val by runarorama
Script
export function myApi(name) {
return "hi " + name;
val_5VEO1wb44f
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_5VEO1wb44f(req) {
try {
// Execute the code directly and capture its result
myApi
@m4olivei
An interactive, runnable TypeScript val by m4olivei
Script
export function myApi(name) {
return "hi " + name;
val_fdwLq1q5lx
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_fdwLq1q5lx(req) {
try {
// Execute the code directly and capture its result
findSlamArticles
@dupontgu
An interactive, runnable TypeScript val by dupontgu
Cron
import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
import { OpenAI } from "https://esm.town/v/std/openai";
import { blob } from "https://esm.town/v/std/blob";
const openai = new OpenAI();
export const BLOB_PREFIX = "SLAM_HEADLINE_"
txt: string
export async function getNewsList(): Promise<Headline[] | undefined> {
const targetUrl = "https://www.bing.com/news/search?q=%22slams%22&qft=sortbydate%3d%221%22&form=YFNR" // url.searchParams.get("url");
return undefined
export async function feedToChatGPT(newsItems: Headline[]): Promise<Slam[] | undefined > {
const completion = await openai.chat.completions.create({
messages: [
return undefined;
export default async function run() {
let results = await getNewsList();
cliOld
@pomdtr
Cli Vals Cli vals are a new type of val (same as http, email, cron and script vals). A cli val must use a function without args as it's default export. The function body will run on the user device using deno . An error message will be shown if deno is not installed. export default function() {
if (Deno.args.length == 0) {
console.error("<name> arg is required!");
Deno.exit(1);
}
console.log(`Hey ${Deno.args[0]}!`);
} Fork @pomdtr/example_cli to get started. Of course, you can use a cli framework to parse arguments (ex: cliffy ). Running a cli val Go to https://pomdtr-cli.web.val.run/v/<author>/<name>[?v=<version>] to get a runnable script for your val. You can pipe the script to a shell to test it curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' | sh -s Steve
Hello Steve! Or save it to your $PATH . # save the script to the ~/.local/bin folder
curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' > ~/.local/bin/cli_example
# make the script executable
chmod +x ~/.local/bin/cli_example
# run the installed val
cli_example Steve Allowing cli vals to access private resources Cli vals run on your device, so by default they can only access public/unlisted vals. You can set the DENO_AUTH_TOKENS env var in your shell config to allow deno to import private vals. export DENO_AUTH_TOKENS=<your-token>@esm.town Cli vals don't have access to val town tokens. Instead of trying to replicate your valtown secrets locally, you can configure your cli vals to call your http endpoints using fetch .
HTTP
# Cli Vals
Cli vals are a new type of val (same as http, email, cron and script vals). A cli val must use a function without args as it's default export.
The function body will run on the user device using [deno](https://deno.com). An error message will be shown if deno is not installed.
```typescript
export default function() {
if (Deno.args.length == 0) {
myApi
@amirmasoudabdol
An interactive, runnable TypeScript val by amirmasoudabdol
Script
export function myApi(name) {
return "hi " + name;
myApi
@broen
An interactive, runnable TypeScript val by broen
Script
export function myApi(name) {
return "hi " + name;
movieMashup
@dthyresson
Movie Mashup It's Blader Runner meets Pretty in Pink. OpenAI generated movie maship title, tagline and treatments. Fal generated movie posters.
HTTP
It's Blader Runner meets Pretty in Pink.
OpenAI generated movie maship title, tagline and treatments.
Fal generated movie posters.
myApi
@anderjason
An interactive, runnable TypeScript val by anderjason
Script
export function myApi(name) {
return "hi " + name;
vt_backup_endpoint
@nbbaier
An interactive, runnable TypeScript val by nbbaier
HTTP
`${API_URL}/v1/users/${id}/vals`,
headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
export default async function(req: Request): Promise<Response> {
return Response.json({ url: `${API_URL}/v1/users/${id}/vals` }); // paginatedResponse(req, vals, 100);
chatgptPromptWebsite
@tarekr93
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function AdvancedPromptGenerator() {
const [role, setRole] = useState('');
</div>
function client() {
createRoot(document.getElementById("root")).render(<AdvancedPromptGenerator />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
valle_tmp_54185991019187464068579562776686
@janpaul123
@jsxImportSource https://esm.sh/react
HTTP
import OpenAI from "npm:openai";
unless strictly necessary, for example use APIs that don't require a key, prefer internal function
functions where possible. Unless specified, don't add error handling,
The val should create a "export default async function main" which is the main function that gets
// The val should create a "export default async function main() {" which
// is the main function that gets executed, without any arguments. Don't return a Response object,
function write(text) {
function updateValName(valName) {
function saveVal() {
function openTab(tab) {