1# Upstash redis client for vals.
2
3Creates a global redis instance and exposes functions to use it.
4
5To use, create a redis database on [Upstash](https://upstash.com/) and set the environment variables.
136import { renderToString } from "npm:react-dom/server";
137
138export default async function() {
139 const mem = new RefuncMemory();
140 const varBindings = {};
2const { loadPyodide } = await import("https://www.unpkg.com/pyodide/pyodide.mjs");
3const pyodide = await loadPyodide();
4export function runPythonAsync(s) {
5 return pyodide.runPythonAsync(s);
6}
25};
26
27function getNotionId(section_id) {
28 if (!section_id) {
29 return [todoist_dict_mapping["dump"]["notion-map-type"], todoist_dict_mapping["dump"]["notion-id"]];
42}
43
44function convertDateObject(due) {
45 function convertToISOWithOffset(datetimeStr, timezoneStr) {
46 const date = new Date(datetimeStr);
47 const [, sign, hours, minutes] = timezoneStr.match(/GMT ([+-])(\d{1,2}):(\d{2})/);
68}
69
70async function addCalloutToNotionPage(page_id, content, date) {
71 console.log(JSON.stringify(date));
72 const response = await notion.blocks.children.append({
102}
103
104async function addPageToNotionDatabse(database_id, content) {
105 const response = await notion.pages.create({
106 "parent": {
120}
121
122export default async function(interval: Interval) {
123 var tasks = await todoistapi.getTasks({
124 projectId: add_to_notion_todoist_project_id,
1export function cleanHtml(html: string) {
2 // Remove script, link tags
3 html = html.replace(
1import { watchWebsite } from "https://esm.town/v/chet/watchWebsite";
2
3export default async function(interval: Interval) {
4 await watchWebsite("https://www.livenation.com/venue/KovZpZAJ6lvA/ace-of-spades-events");
5}
3import { fetch } from "npm:cross-fetch";
4
5export default async function(interval: Interval) {
6 const NOTION_API_KEY = process.env.NOTION_API_KEY;
7 const PAPERPILE_DB_ID = "DB_ID_GOES_HERE";
60 )
61 }`,
62 ).then((r) => r.json()).catch(function() {
63 console.log("Promise Rejected");
64 });
40};
41
42async function valtown(path: string): Promise<[number, object | null]> {
43 const req = await fetch(path, {
44 headers: {
54}
55
56async function git(
57 args: string[],
58 env: { [key: string]: string } = {},
67
68// Get all the vals for the user.
69async function getVals(me: User): Promise<Val[]> {
70 const vals = [];
71 let next_page:
84
85// Write every version of the val to a file and commit it (unless there's no changes).
86async function syncVals(vals: Val[]) {
87 for (let i = 0; i < vals.length; i++) {
88 const val = vals[i];
130}
131
132export default async function main() {
133 // check for api key
134 const api_key = Deno.env.get("valtown");
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
2
3export default async function(interval: Interval) {
4 const versions = await fetch("https://www.figma.com/api/plugins/1323092380415927575/versions").then(r => r.json());
5 const { install_count, like_count, view_count } = versions.meta.plugin;
1import { getThreadsActivity } from "https://esm.town/v/glommer/getThreadsActivity";
2
3export default async function(interval: Interval) {
4 const guild = Deno.env.get("DISCORD_GUILD_ID");
5 const token = Deno.env.get("DISCORD_IKU_BOT_TOKEN");
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.