5*/
67export default async function(req: Request): Promise<Response> {
8const htmlContent = `
9<!DOCTYPE html>
4*/
56export default async function main(req: Request): Promise<Response> {
7// Define some example stories
8const stories = [
3// we can make it interactive with additional scripts.
45export default async function(req: Request): Promise<Response> {
6const htmlContent = `
7<!DOCTYPE html>
9};
1011async function getBitcoinData() {
12try {
13const [priceResponse, historyResponse] = await Promise.all([
34}
3536function getChange(prices, times, daysAgo) {
37const now = new Date().getTime();
38const targetTime = now - daysAgo * 24 * 60 * 60 * 1000;
44}
4546function calculateSMA(prices, period) {
47return prices.slice(-period).reduce((sum, price) => sum + price, 0) / period;
48}
4950function formatPrice(price) {
51return Math.round(price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
52}
5354function daysBetween(date1, date2) {
55const oneDay = 24 * 60 * 60 * 1000;
56return Math.abs((date1 - date2) / oneDay);
57}
5859function calculatePowerLawSupport(daysSinceGenesis) {
60const logPrice = -17.35 + 5.836 * Math.log10(daysSinceGenesis);
61return Math.pow(10, logPrice);
62}
6364function generateSupportPrices(currentPrice) {
65const genesisDate = new Date(2009, 0, 3);
66const today = new Date();
81}
8283function BitcoinData({ data }) {
84if (!data) return <p>Failed to fetch Bitcoin data.</p>;
85162}
163164export default async function(req: Request) {
165const bitcoinData = await getBitcoinData();
166
similarSitesmain.tsx2 matches
5const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
67export default async function handler(req: Request): Promise<Response> {
8const url = new URL(req.url).searchParams.get("url") || "https://thesephist.com/posts/synth/";
9const searchResults = await exa.findSimilarAndContents(url, {
52// Override the link renderer
53const renderer = new marked.Renderer();
54renderer.link = function(href, title, text) {
55if (typeof href === 'object') {
56text = href.text || text;
6);
78export async function uptimeCheck(url: string) {
9let reason: string, status: number, end: number;
10let ok = true;
testBasicAuthmain.tsx1 match
2import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
34function handler(req: Request) {
5return new Response("You are authenticated!");
6}
audioManagermain.tsx8 matches
4344export class AudioManager {
45constructor(apiKey=null, uploadFunction = null, downloadFunction = null) {
46this.openai = new OpenAI(apiKey);
47this.uploadFunction = uploadFunction || this.blobUpload;
48}
4950// valtown blob upload function
51async blobUpload(buffer, key) {
52try {
111console.log(blob instanceof Blob); // Should be true
112console.log(typeof blob); // Should be true
113console.log(typeof blob.arrayBuffer); // Should be "function"
114return blob;
115}
164165async uploadAudio(blob, key) {
166if (!this.uploadFunction) {
167console.error("No upload function provided to upload audio");
168return null;
169}
170171// const buffer = await blob.arrayBuffer();
172const res = await this.uploadFunction(blob, key);
173if (res) {
174return res;
180181182// Function to fetch audio data and return as ArrayBuffer
183async getAudioBuffer(url) {
184const response = await fetch(url);
brownPelicanmain.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
CronScrapermain.tsx1 match
2import { email } from "https://esm.town/v/std/email";
34export async function main() {
5const areas: Area[] = [
6{