Search
cerebras_coder
@caseyg
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
async function handleSubmit(e: React.FormEvent) {
function client() {
client();
const client = new Cerebras();
const completion = await client.chat.completions.create({
audio03
@all
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import * as d3 from "https://esm.sh/d3";
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(req: Request): Promise<Response> {
savvyPurpleSpoonbill
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
async function handleSubmit(e: React.FormEvent) {
function client() {
client();
const client = new Cerebras();
const completion = await client.chat.completions.create({
solanaPayDemo
@vawogbemi
Solana Pay Demo A fork of solana-pay-qrcode-generator
HTTP
/** @jsxImportSource https://esm.sh/react */
import {
import BigNumber from "https://esm.sh/bignumber.js";
import React, { useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function Home() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<Home />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
chatWithCerebras
@lazyplatypus
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
import React, { useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const MODELS = ["llama3.1-8b", "llama3.1-70b"];
}, [htmlOutput]);
const sendMessage = async (e?: React.FormEvent) => {
e?.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
const { messages, model } = await request.json();
const client = new Cerebras();
try {
const completionCreateResponse = await client.chat.completions.create({
messages,
reactClientDemo
@wilhelm
Idiomatic SSR and hydration of a React app
HTTP
Idiomatic SSR and hydration of a React app
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
const Counter = () => {
const [count, setCount] = React.useState(0);
return (
<body>
<h1>Val Town React Client Demo</h1>
<Counter />
if (typeof document !== "undefined") {
const { hydrateRoot } = await import("https://esm.sh/react-dom/client");
hydrateRoot(document, <App />);
export default async function(req: Request): Promise<Response> {
const { renderToReadableStream } = await import("https://esm.sh/react-dom/server");
const stream = await renderToReadableStream(<App />, { bootstrapModules: [import.meta.url] });
eventsInNYC
@synco
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
const INITIAL_EVENTS = {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
BTCPriceChecker
@ericxyz86
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function CryptoPriceApp() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<CryptoPriceApp />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
GDI_SSE
@rozek
This val is part of a series of examples to introduce "val.town" in my computer science course at
Stuttgart University of Applied Sciences . The idea is to motivate even first-semester students not to wait but to put their
ideas into practice from the very beginning and implement web apps with
frontend and backend. It contains a simple web page which sends a GET request to a preconfigured
server that responds with a series of "Server-sent Events" (SSE) which are then shown one after
another before the connection to the server is closed. This val is the companion of https://rozek-gdi_sseservice.web.val.run/ which contains the server part (aka "backend") for this example. The code was created using Townie - with only a few small manual corrections. This val is licensed under the MIT License.
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default async function server(request: Request): Promise<Response> {
ciceroAISiteDesign
@arthrod
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState, useEffect, useRef } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import styled, { createGlobalStyle, keyframes, StyleSheetManager } from "https://esm.sh/styled-components@5.3.9";
function App() {
const [isNavOpen, setIsNavOpen] = React.useState(false);
const toggleNav = () => {
</Footer>
function client() {
const root = document.getElementById("root");
if (typeof document !== "undefined") {
client();
export default async function server(request: Request): Promise<Response> {
realMiningApps
@Sagar445
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
// Cryptocurrency Mining Simulator
return <CryptoMiningApp />;
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request) {
preciseAquamarineReptile
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
async function handleSubmit(e: React.FormEvent) {
function client() {
client();
const client = new Cerebras();
const completion = await client.chat.completions.create({
efficientWhiteBobolink
@deepmojo
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
const clientCode = `
import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
root.render(React.createElement(React.StrictMode, null, React.createElement(App)));
<script type="module" src="/client.js"></script>
} else if (req.method === "GET" && url.pathname === "/client.js") {
return new Response(clientCode, {
extremePlumCaribou
@ejfox
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import DOMPurify from "https://esm.sh/dompurify";
return '❓'; // Placeholder
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
throw new Error('valtown token is not set');
const client = new ValTown({ apiKey: token });
const user = await client.alias.username.retrieve(username);
if (!user || !user.id) {
let vals = [];
for await (const val of client.users.vals.list(user.id, { limit: 100 })) {
vals.push(val);
theOneSky
@karkowg
theonesky bsky firehose as The Matrix source code
HTTP
/** @jsxImportSource https://esm.sh/react */
import { BskyAgent } from "https://esm.sh/@atproto/api";
import React, { useCallback, useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function createTypewriterMachine() {
return <MatrixBlueskyStream />;
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {