Search
market_kelly_bet
@case
// Copied from https://github.com/Will-Howard/manifolio/blob/master/manifolio-ui/lib/calculate.ts
HTTP
// Copied from https://github.com/Will-Howard/manifolio/blob/master/manifolio-ui/lib/calculate.ts
function calculateNaiveKellyBet({
marketProb,
outcome,
async function getMarket(slug: string) {
const res = await fetch(`https://api.manifold.markets/v0/slug/${slug}`);
return res.json();
export default async function(req: Request): Promise<Response> {
const searchParams = new URL(req.url).searchParams;

update
@adamgonda
An interactive, runnable TypeScript val by adamgonda
Script
import { moveSnake } from "https://esm.town/v/adamgonda/moveSnake";
import { pipe } from "https://esm.town/v/adamgonda/pipe";
export function update({ state, input }) {
const newState = pipe(state)(
// turnSnake(input),
nearestOpenStation
@tmcw
An interactive, runnable TypeScript val by tmcw
Script
lon = +lon;
lat = +lat;
function dist(station) {
return Math.sqrt(
Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)
tProxy
@tmcw
An interactive, runnable TypeScript val by tmcw
Script
? undefined // to avoid ValTown unwrapping the promise, caused the script to hang
: typeof prop !== "string"
? undefined // something is autocalling it with symbol
: prop === "ib"
? t("div", { $display: "inline-block" })
endpoint_2auxb4
@dcm31
An interactive, runnable TypeScript val by dcm31
Script
export default function handler(request: Request): Response {
// This is a boilerplate handler for GET test5
// Modify this function to implement your desired behavior
return new Response(JSON.stringify({
message: "This is the GET endpoint for test5",

fetchNewPublicGitHubRepos
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export default async function fetchNewPublicGitHubRepos() {
// Generate today's date in YYYY-MM-DD format
const today = new Date().toISOString().split("T")[0];
lovelyYellowXerinae
@mikehiggins
// Expanded stopwords list with additional web-specific terms
Script
// Simple sentiment analysis function (unchanged)
function analyseSentiment(text) {
function calculateTFIDF(text, outputSize = 7) {
// Updated function to calculate word frequency
function calculateWordFrequency(text, topN = 30) {
// Updated function to generate a fun fact
function generateFunFact(text) {
// Function to generate a simple summary (unchanged)
function generateSummary(text, sentenceCount = 3) {
// Updated function to clean the extracted text
fantasticPurplePossum
@maxm
An interactive, runnable TypeScript val by maxm
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({ ok: false });
reactExample
@richardwu9
An interactive, runnable TypeScript val by richardwu9
HTTP
export default async function(req: Request): Promise<Response> {
return new Response(JSON.stringify({ message: "Test successful!" }), {
status: 200,
valle_tmp_98139518017595684072811081715226
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {

laudableFuchsiaMastodon
@stevekrouse
👕 Shirtgen API Endpoint Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between the standard "Flux Schnell" model or the enhanced "Pro" model. Perfect for creating unique custom apparel in seconds! 🚀 💡 How it Works Send a POST request to the endpoint with your design prompt. Toggle between Standard and Pro models using the useProModel flag. The AI generates a high-quality t-shirt design based on your prompt. 📥 Expected POST Data {
"prompt": "A retro sunset with palm trees 🌴🌅",
"useProModel": true
}
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [prompt, setPrompt] = useState("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
if (request.method === "POST") {
srcbackend
@tempdev
// console.log(await doodstreamExtractor("9x3w3pu0xemy"));
Script
url: string;
export async function Fetcher(url: string, referer: string) {
const design = `?destination=${encodeURIComponent(url)}&referer=${encodeURIComponent(referer)}`;
return request.text();
export async function doodstreamExtractor(id: string): Promise<DataSheet> {
const returnData: DataSheet = {
// console.log(await doodstreamExtractor("9x3w3pu0xemy"));
export async function streamtapeExtractor(id: string): Promise<DataSheet> {
console.log(id);

increasemiraclechildcounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
let { miraclechildcounter } = await import("https://esm.town/v/politelyinvinciblepointer/miraclechildcounter");
export function increasemiraclechildcounter() {
miraclechildcounter++;