Search

Results include substring matches and semantically similar vals. Learn more
cameronpak avatar
homeless
@cameronpak
Homeless Services by OurTechnology At OurTechnology , we create technology solutions to empower and equip those who serve the homeless. We have a large data set of available resources in the US to aid in helping those experiencing homelessness find local resources, community, and support. This private ( but public to read ) API is used in our ChatGPT Assistant, Homeless Services . Why a ChatGPT Assistant ? OpenAI announced on May 13, 2024 that free users will soon be able to "discover and use GPTs and the GPT Store ( OpenAI )" There's a larger number of people experiencing homelessness who own a phone than what I imagined. ChatGPT allows for a simple interface, even with voice chat (a more natural way to navigate the tool), to find resources to help those experiencing homelessness. And, it's fast! Technical details The data set has been compiled together over the years and will continue to be updated as new techniques and partnerships make that possible. We use Typesense , a search as a service tool, to provide lightning fast search results for homeless resources near you. This endpoint is created with Hono and is an incredibly easy way to create an API. Contact OurTechnology Visit our website Email us! Find us on LinkedIn While this is on Cameron Pak's ValTown, this code is owned and operated by OurTechnology.
HTTP (deprecated)
"resources": "resources",
const typesenseClient = new Typesense.Client({
"nodes": [{
// console.log("Search params:", searchParams); // Add this line
let resources = await typesenseClient
.collections(COLLECTIONS.resources)
searchParams.filter_by = "";
resources = await typesenseClient.collections(COLLECTIONS.resources).documents().search(searchParams);
const resourcesWithDistance = resources.hits?.map((hit) => {
mjweaver01 avatar
PersonalizationGPT
@mjweaver01
PersonalizationGPT You are a helpful personalization assistant Use GPT to return JIT personalization for client side applications. If you fork this, you'll need to set OPENAI_API_KEY in your Val Town Secrets .
HTTP (deprecated)
> You are a helpful personalization assistant
Use GPT to return JIT personalization for client side applications.
If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
jamiedubs avatar
alchemyClient
@jamiedubs
simple wrapper for Alchemy's blockchain APIs , for fetching blockchain data. Ethereum, Solana, etc uses my personal ALCHEMY_API_KEY, I forget if you can use it too or not! get your own if it doesn't work used by some of my other vals: https://www.val.town/v/jamiedubs/nftMetadata etc
Script
simple wrapper for [Alchemy's blockchain APIs](https://docs.alchemy.com/reference/alchemy-gettokenbalances), for fetching blo
uses my personal ALCHEMY_API_KEY, I forget if you can use it too or not! get your own if it doesn't work
used by some of my other vals:
- https://www.val.town/v/jamiedubs/nftMetadata
- etc
type TokenParam = "erc20" | "nft" | string;
export async function alchemyFetch(path: string, tokens: TokenParam = "erc20") {
const apiKey = process.env.ALCHEMY_API_KEY;
if (!apiKey) throw new Error("missing ALCHEMY_API_KEY");
const baseUrl = tokens == "nft" ? "https://eth-mainnet.g.alchemy.com/nft/v2" : "https://eth-mainnet.g.alchemy.com/v2";
nbbaier avatar
shadcnButton
@nbbaier
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react **/
import { Slot } from "https://esm.sh/@radix-ui/react-slot";
import { cva, type VariantProps } from "https://esm.sh/class-variance-authority";
import * as React from "https://esm.sh/react";
import { cn } from "https://esm.town/v/nbbaier/shadcnUtils";
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
asChild?: boolean;
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
petermillspaugh avatar
interleaving
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { generateLessonHtml } from "https://esm.town/v/petermillspaugh/lessonTemplate";
import { renderToString } from "npm:react-dom/server";
* Note: this lesson is a work in progress 👷‍♂️
const TITLE = "Interleaving";
webup avatar
getVectorStoreBuilder
@webup
An interactive, runnable TypeScript val by webup
Script
await import("npm:dotenv");
const { PineconeClient } = await import(
"npm:@pinecone-database/pinecone"
const client = new PineconeClient();
await client.init({
apiKey: process.env.PINECONE,
environment: "asia-southeast1-gcp-free",
const pineconeIndex = client.Index("langchain-valtown");
const { PineconeStore } = await import(
"npm:langchain/vectorstores/pinecone"
// PineconeStore.fromDocuments() gives out PineClient upsert error
return await PineconeStore.fromExistingIndex(model, {
nmsilva avatar
forbetEventService
@nmsilva
An interactive, runnable TypeScript val by nmsilva
Script
import moment from "https://esm.sh/moment";
import { createClient } from "npm:@supabase/supabase-js";
class ForbetEventService {
_supabase;
constructor() {
this._supabase = createClient(
Deno.env.get("SUPABASE_URL"),
Deno.env.get("SUPABASE_ANON_KEY"),
crif avatar
bookmark
@crif
A minimal bookmarking tool This allows you to bookmark links and view them later. Completely powered by ValTown and SQLite. To set this up for yourself Fork the val From your ValTown settings page, add an environment variable named bookmarks_client_id and give it a value (you will be using this for saving) Add another environment variable named bookmarks_client_secret and give it a value (you will also be using this for saving) At first, the "bookmarks" table will not exist, so we need to save an article first, which will create the "bookmarks" table To do this, add a bookmarklet to your browser with this value (replace BOOKMARKS-CLIENT-ID and BOOKMARKS-CLIENT-SECRET with the values you added to the environment variables, and replace BOOKMARKS-URL with your VAL's URL): javascript:void(open('BOOKMARKS-URL/save?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title)+'&id=BOOKMARKS-CLIENT-ID&secret=BOOKMARKS-CLIENT-SECRET', 'Bookmark a link', 'width=400,height=450')) Click this bookmarklet to bookmark the URL of the current active tab Go to your VAL URL homepage to see the bookmark Demo Here are my bookmarks: https://ramkarthik-bookmark.web.val.run/ Note Make sure you don't share bookmarks_client_id and bookmarks_client_secret . It is used for authentication before saving a bookmark.
HTTP (deprecated)
1. Fork the val
rom your ValTown settings page, add an environment variable named `bookmarks_client_id` and give it a value (you will be usin
3. Add another environment variable named `bookmarks_client_secret` and give it a value (you will also be using this for savi
4. At first, the "bookmarks" table will not exist, so we need to save an article first, which will create the "bookmarks" tab
this, add a bookmarklet to your browser with this value (replace `BOOKMARKS-CLIENT-ID` and `BOOKMARKS-CLIENT-SECRET` with th
onent(location.href)+'&t='+encodeURIComponent(document.title)+'&id=BOOKMARKS-CLIENT-ID&secret=BOOKMARKS-CLIENT-SECRET', 'Book
6. Click this bookmarklet to bookmark the URL of the current active tab
### Note
Make sure you don't share `bookmarks_client_id` and `bookmarks_client_secret`. It is used for authentication before saving a
return c.text("Authentication details (ID/Secret) missing!");
if (id != Deno.env.get("bookmarks_client_id") || secret != Deno.env.get("bookmarks_client_secret")) {
return c.text("Unauthorized!");
petermillspaugh avatar
sendLessonResponses
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { lessons } from "https://esm.town/v/petermillspaugh/lessons";
import { email as sendEmail } from "https://esm.town/v/std/email?v=11";
import { renderToString } from "npm:react-dom/server";
export async function sendLessonResponses({ email, lesson, formData }) {
const fillBlankResponse = formData.get("fill-in-the-blank") as string;
std avatar
catch
@std
Catch This val is a helper for Townie, which sends client-side errors up to the top frame so that Townie can assist you in fixing them.
Script
# Catch
This val is a helper for Townie, which sends client-side
errors up to the top frame so that Townie can assist you in fixing them.
apppeak avatar
dailyPeachSalmon
@apppeak
An interactive, runnable TypeScript val by apppeak
Cron
import process from "node:process";
import { Client } from "npm:@notionhq/client";
import dayjs from "npm:dayjs";
const DATABASE_ID = "519446a0d3ed47038fffd669b9ece770";
const notion = new Client({ auth: process.env.NOTION_API_KEY });
const intervalMapping = {
"Weekly": (date) => dayjs(date).add(1, "week"),
jamisonl avatar
darkMagentaFlamingo
@jamisonl
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
HTTP (deprecated)
import { createAudioResource, createAudioPlayer, joinVoiceChannel, VoiceConnectionStatus } from '@discordjs/voice';
import { Client, GatewayIntentBits } from 'discord.js';
import googleTTS from 'google-tts-api';
const starting_amount = 5;
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates] });
const pendingSimonSays = new Map();
client.on('voiceStateUpdate', async (oldState, newState) => {
const userId = newState.id;
//is this accurate
client.login(process.env.DISCORD_BOT_TOKEN);
if (!bank) {
nmsilva avatar
supabaseCache
@nmsilva
An interactive, runnable TypeScript val by nmsilva
Script
import moment from "npm:moment";
import { createClient } from "npm:@supabase/supabase-js";
class CacheService {
_supabase;
constructor() {
this._supabase = createClient(
Deno.env.get("SUPABASE_URL"),
Deno.env.get("SUPABASE_ANON_KEY")
dvsj avatar
subscribeToNewsletter
@dvsj
Add an email entry option to your static website/blog. Easy peasy. 🚀 PoV: You just hacked together a portfolio website or launched a blog as a static website. Some people who visit might be interested in hearing more from you. ❤️ But you don't want to get lost building your backend, API, DB or fancy apps like SubstandardStack or MailMachineGun for people to sign up to your newsletter. 😩 All you want is a simple input box on your website - when someone types their email , username or social link in and submits it, you want to be notified. psst...do you want another one that uses the DB instead of email so you can look up all entries at once? Let me know and I'll get cooking! Quickstart Call the val URL with data in the query param userContact . That's it! // Format `https://<val_url>?userContact=<mandatory_primary_contact>` // Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in` `https://dvsj-subscribeToNewsletter.web.val.run?userContact=CatalanCabbage` Bonus Have extra data apart from email? Pass any encoded data in the queryParam userData , will be included in the email. It's optional. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&userData={"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"}` // Note: All values should be URL encoded. Example: let userData = {"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"} let encodedUserData = encodeURIComponent(userData) //This should go in the query param Want bot protection? Add a simple question to your website, like "okay, so what's one minus one?" . In the val, set isBotProtectionOn = true and botProtectionAnswer="0" . When you call the val, include the encoded user's answer to the bot question as botProtection query param. Answer will be compared with botProtectionAnswer ; if the answer is wrong, the request is rejected. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>&botProtection=<answer>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&botProtection=123` Add it to your website Want to add it to your site but get a headstart coding it? Use this ChatGPT prompt to get code for your website! I'm building a simple form submission component. It should a submit button and these 2 input boxes: 1. "userContact" to get the user's email (mandatory) 2. "userData" to get a custom message from the user (optional) On clicking the submit button: 1. Both input values should be encoded using "encodeURIComponent" 2. A GET URL should be built in this format with query params. Include userData query param only if input is not null or empty. `https://dvsj-subscribeToNewsletter.web.val.run?userContact=<encodedUserContact>&userData=<encodedUserData>` 3. The GET URL should be called and result printed in the console. I'm using React, so make it a react component.
HTTP (deprecated)
3. The GET URL should be called and result printed in the console.
I'm using React, so make it a react component.
nbbaier avatar
WriterOptions
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
import { type ClientOptions } from "npm:openai";
export interface WriterOptions extends ClientOptions {
model?: string;