Search

Results include substring matches and semantically similar vals. Learn more
shayne avatar
getRaycastDownloadCount
@shayne
An interactive, runnable TypeScript val by shayne
Script
export const getRaycastDownloadCount = (async () => {
const { DOMParser } = await import(
"https://deno.land/x/deno_dom/deno-dom-wasm.ts"
const url = "https://www.raycast.com/tailscale/tailscale";
const response = await fetch(url);
const html = await response.text();
const document = new DOMParser().parseFromString(html, "text/html");
const data = await JSON.parse(
document.getElementById("__NEXT_DATA__").textContent
return data.props.pageProps.fallback["users/tailscale/extensions/tailscale"]
andreterron avatar
tidbytDeviceInfo
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export function tidbytDeviceInfo({ deviceId, apiKey }: {
deviceId: string;
apiKey: string;
return fetchJSON(
`https://api.tidbyt.com/v0/devices/${deviceId}`,
headers: {
Authorization: `Bearer ${apiKey}`,
ryoid avatar
SolanaJupiterSwapEventParser
@ryoid
An interactive, runnable TypeScript val by ryoid
Script
const input = bytes(`
04 e9 e1 2f bc 84 e8 26 c9 32 cc e9 e2 64 0c ce
15 59 0c 1c 62 73 b0 92 57 08 ba 3b 85 20 b0 bc
06 9b 88 57 fe ab 81 84 fb 68 7f 63 46 18 c0 35
da c4 39 dc 1a eb 3b 55 98 a0 f0 00 00 00 00 01
a0 86 01 00 00 00 00 00 05 2e e1 83 38 96 96 9f
8c d1 cd 46 83 18 c5 98 c7 e0 58 96 07 4a 59 1c
2a e0 98 60 2f 16 80 00 d9 34 05 00 00 00 00 00
export function publicKey(data: Uint8Array, offset: number) {
return base58.encode(data.subarray(offset, offset + 32));
effector avatar
effector
@effector
An interactive, runnable TypeScript val by effector
Script
export async function effector() {
const effector = await import("https://esm.sh/effector@22.8.6");
return effector;
brezina avatar
MattsSFsailingNotify
@brezina
// Copilot output maxWind and maxTemp_f to hmtl
Script
export async function sailingNotify(
where: string,
minWindMph = 1,
minTemp = 1,
const forecast = await getWeather(where, 10);
// Could filter only for hours during the day.
// forecast.forecast.forecastday.map((day) => {
// day.hour.map((hour) => {
// const hourInt = parseInt(hour.time.split(" ")[1].split(":")[0]);
// if (hourInt >= 10 && hourInt <= 19) {
steveb1313 avatar
LoginPeloton
@steveb1313
An interactive, runnable TypeScript val by steveb1313
Script
export async function LoginPeloton(
req: express.Request,
res: express.Response,
let response = await fetch("https://api.onepeloton.com/auth/login", {
method: "POST",
mode: "no-cors",
headers: {
"Content-Type": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
body: JSON.stringify({
lengyue avatar
headersExample
@lengyue
An interactive, runnable TypeScript val by lengyue
HTTP (deprecated)
export const headersExample = (request: Request) => {
return Response.json(Object.fromEntries(request.headers.entries()));
andreterron avatar
testApi
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export const testApi = (async () => {
const threshold = 90;
const opts = {
headers: {
Authorization: `Bearer ${process.env.vt_token}`,
const me = await fetchJSON(
"https://api.val.town/v1/me",
opts,
// TODO: Paginate
const vals = await paginateAPI(
bitbloxhub avatar
chatGptUnoCss
@bitbloxhub
// Forked from @patrickjm.chatGptExample
Script
import { chatGpt } from "https://esm.town/v/patrickjm/chatGpt?v=3";
export const chatGptUnoCss = chatGpt({
messages: [
role: "user",
content:
"Why would one want to use unocss instead of other css styling solutions, like bootstrap?",
.then((msg) => msg.content.split("\n").filter((line) => line.length));
// Forked from @patrickjm.chatGptExample
LavaC avatar
getWttr
@LavaC
An interactive, runnable TypeScript val by LavaC
HTTP (deprecated)
export let getWttr = async ({ location }) => {
function convertBlobToDataUrl(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const dataUrl = reader.result;
resolve(dataUrl);
reader.onerror = () => {
reject(reader.error);
reader.readAsDataURL(blob);
andreterron avatar
axiosTest
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export const axiosTest = (async () => {
const { default: axios } = await import("npm:axios");
const res = await axios.get("https://jsonplaceholder.typicode.com/todos/1");
return res;
Timmy avatar
main
@Timmy
An interactive, runnable TypeScript val by Timmy
Cron
export async function main() {
let latestIssue = 643;
const init = (async () => {
const currentIssueNumber = await getIssueNumber;
console.log(currentIssueNumber, "--------");
if (currentIssueNumber > latestIssue) {
latestIssue = currentIssueNumber;
await email({
text:
`There is a new issue on JavaScript Weekly: https://javascriptweekly.com/issues ${latestIssue}`,
stevekrouse avatar
rssDemo10
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Cron
import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems";
export async function rssDemo10(interval) {
let items = await newRSSItems({
url: inkAndSwitchRssUrl,
lastRunAt: interval.lastRunAt,
if (items?.length)
return email({
text: JSON.stringify(items, null, 2),
subject: "New from Ink & Switch",
byjonathanleung avatar
get1
@byjonathanleung
An interactive, runnable TypeScript val by byjonathanleung
Script
export let get1 = (x) => {
return "hello world";
tempguy avatar
yellowYak
@tempguy
// This is an IIFE to allow the use of top-level await in Node.js
Script
// This is an IIFE to allow the use of top-level await in Node.js
(async () => {
try {
const options = {
uri: "https://website.com/",
formData: { field1: "value", field2: 2 },
const response = await cloudscraper.post(options);
console.log(response);
} catch (error) {
console.error(error);