test_explorer_routermain.tsx2 matches
63});
6465async function loadTests(): Promise<TestType[]> {
66const query = `https://esm.town/v/${author}/test_explorer`;
67const { data: vals } = await api(`/v1/search/vals?query=${query}`, { authenticated: true });
90}
9192async function loadHistory(): Promise<HistoryEntry[]> {
93try {
94const entries = await readHistory();
62});
6364async function loadTests(): Promise<TestType[]> {
65const query = `https://esm.town/v/${author}/test_explorer`;
66const { data: vals } = await api(`/v1/search/vals?query=${query}`, { authenticated: true });
89}
9091async function loadHistory(): Promise<HistoryEntry[]> {
92try {
93const entries = await readHistory();
blobbyFacemain.tsx4 matches
171819async function streamToBuffer(stream) {
20const chunks = [];
21const reader = stream.getReader();
32}
3334async function detectFileType(buffer) {
35const type = await fileTypeFromBuffer(buffer);
36// return type ? type.mime : 'unknown';
424344export async function get(key, c) {
45let result = await blobby.get(key);
46// console.log('raw result for key:', result, typeof result);
185newKeyName: '',
186187init: async function() {
188console.log('blobby:', this.blobby);
189},
counterTownmain.tsx6 matches
4import { Hono } from "npm:hono";
56function setupTable() {
7return sqlite.execute(`create table if not exists counter_town (
8time timestamp default current_timestamp,
21// TODO - we should probably not expose this to our users
22// this rewrite removes that and stores the url underneath
23function removeCustomDomainRewriter(req) {
24const servedFor = req.headers.get("x-served-for");
25return req.url.replace("saascustomdomains.val.run", servedFor);
26}
2728function countRequest(req: Request) {
29console.log(req);
30return sqlite.execute({
41}
4243export function counterTownMiddleware(handler) {
44return async function(req: Request) {
45// don't await this so it doesn't add to the timing
46countRequest(req).catch(e => console.error(e));
125126// zipped execute
127async function execute(sql) {
128const results = await sqlite.execute(sql);
129return results.rows.map(row =>
slack_cleanermain.tsx12 matches
1export function slackHTMLToMarkdown(html) {
2removeAbsolutePositioning();
39let markdown = "";
1011function convertMessage(messageElement) {
12function safeGetAttribute(selector, attribute) {
13const element = messageElement.querySelector(selector);
14return element ? element.getAttribute(attribute) : "";
28let messageMarkdown = "";
2930function processNode(node) {
31if (node.nodeType === Node.TEXT_NODE) {
32return node.textContent;
122// -----
123124function postProcessMarkdown(markdown) {
125// Split the markdown into lines
126let lines = markdown.split("\n");
155}
156157function parseTimestamp(ariaLabel) {
158const now = new Date();
159const months = [
203}
204205function removeAbsolutePositioning() {
206// Get all elements on the page
207var allElements = document.getElementsByTagName("*");
333import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
334335window.convertToMarkdown = function() {
336const htmlInput = document.getElementById("htmlInput").innerHTML;
337const markdown = slackHTMLToMarkdown(htmlInput);
341}
342
343function copyToClipboard(selector, { html }) {
344const target = document.querySelector(selector);
345352}
353354function copyMarkdownAndHTMLToClipboard() {
355const mdTarget = document.querySelector('#markdownOutput');
356const htmlTarget = document.querySelector('#renderedMarkdown');
364}
365
366async function pasteFromClipboard() {
367const clipboardItems = await navigator.clipboard.read();
368for (const clipboardItem of clipboardItems) {
407`;
408409export default async function(req: Request) {
410return new Response(html, {
411headers: {
1async function getWikipediaInfo(url: string) {
2// Extract the title from the URL
3const title = url.split("/wiki/")[1];
25}
2627export default async function(req: Request): Promise<Response> {
28const url = new URL(req.url);
29const path = url.pathname.replace(/^\/proxy/, "");
51${ogMetaTags}
52<script type="text/javascript">
53setTimeout(function() {
54window.location.href = "${wikipediaUrl}";
55}, 0);
yellowSpidermain.tsx1 match
1import { jsPython } from "npm:jspython-interpreter";
2const interpreter = jsPython()
3.addFunction("fetch", fetch);
4const script = `
5print(fetch("https://datasette.simonwillison.net/simonwillisonblog/blog_quotation.json?_labels=on&_shape=objects").text())
dateme_router_hydratedmain.tsx3 matches
910// Generic loader that forwards on requests for that page's JSON data
11function loader({ request }) {
12return fetch(request, {
13headers: {
1819// Generic action that forwards on non-get Requests
20function action({ request }) {
21if (request.method === "GET") { throw Error("GET not expected here - something is wrong."); }
22return fetch(request);
23}
2425function makeClientSide(routes) {
26return routes.map(route => {
27return {
dateme_routesmain.tsx1 match
37];
3839function Success() {
40return (
41<div className="max-w-md text-lg mx-auto p-6">
dateme_home_reactmain.tsx3 matches
2import { useEffect, useState } from "https://esm.sh/react@18.2.0";
34async function getCurrentPosition(opts): Promise<GeolocationPosition> {
5return new Promise((resolve, reject) => {
6if (!navigator?.geolocation) {
12}
1314async function reverseGeocodeNominat(lat, lng) {
15const url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lng}&zoom=13`;
16const response = await fetch(url);
19}
2021export default function Home() {
22const [locationName, setLocationName] = useState("");
23useEffect(() => {