12* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
35});
3637async function generateGraph(username) {
38console.log(`Fetching contributions for ${username}`);
39try {
56}
5758async function fetchContributions(username) {
59const contributionMap = {};
60const valsUrl = `https://api.val.town/v1/alias/${username}/vals`;
90}
9192async function fetchValVersions(valId, contributionMap, creationDate) {
93const versionsUrl = `https://api.val.town/v1/vals/${valId}/versions`;
94try {
119}
120121function generateContributionGraph(contributionData) {
122const dates = Object.keys(contributionData).sort();
123if (dates.length === 0) {
166}
167168function generateMonthLabels(weeks) {
169const months = [];
170weeks.forEach(week => {
186}
187188function getContributionLevel(count) {
189if (count === 0) return 0;
190if (count < 3) return 1;
194}
195196function getContributionColor(level) {
197const colors = ['#ebedf0', '#9be9a8', '#40c463', '#30a14e', '#216e39'];
198return colors[level];
spacexcalendarmain.tsx1 match
3import moment from "npm:moment-timezone"
45export default async function(req: Request): Promise<Response> {
6const data = await spacexCalendar()
7// return Response.json(data)
1import cheerio from "npm:cheerio@1.0.0-rc.12"
23export default async function(req: Request): Promise<Response> {
4const data = await getLaunches()
5return Response.json(data)
6}
78export async function getLaunches() {
9var y10to19 = await loadPage(
10"https://en.wikipedia.org/wiki/List_of_Falcon_9_and_Falcon_Heavy_launches_(2010%E2%80%932019)",
29}
3031async function loadPage(url) {
32const response = await fetch(url)
33const body = await response.text()
36}
3738function getRows($, h2Selector, tableSelector, parseFunc) {
39var launchesH2 = $(h2Selector).parent()
40var launchesTable = launchesH2.nextAll(tableSelector)
4142var rows = launchesTable.find("tr")
43rows = rows.filter(function(i, el) {
44if ($(this).find("th").length > 2) return false // hide header
45// if ($(this).find("td").first().attr("colspan") == 6) return false // hide year rows
51}
5253function parseFutureRows(rows, $) {
54var launches = []
55var launch: any = {}
56rows.each(function(i, el) {
57$(this).find("br").replaceWith(" ")
58var children = $(this).children()
82return launches
83}
84function parsePastRows(rows, $) {
85var launches = []
86var launch: any = {}
87rows.each(function(i, el) {
88$(this).find("br").replaceWith(" ")
89var children = $(this).children()
115}
116117function getPayloadIcon(text) {
118if (text.toLowerCase().includes("starlink")) return "๐ฐ"
119if (text.toLowerCase().includes("gps")) return "๐"
127}
128129function removeReferences(string) {
130return string.replace(/\[\d+\]/g, "").replace(/\n$/g, "").replace(/\u00A0/g, " ")
131}
extremePlumCariboumain.tsx4 matches
5import { marked } from "https://esm.sh/marked";
67function App() {
8const [vals, setVals] = useState([]);
9const [error, setError] = useState(null);
119}
120121async function fetchEmojiForName(name) {
122try {
123const response = await fetch(`/emoji/${encodeURIComponent(name)}`);
133}
134135function client() {
136createRoot(document.getElementById("root")).render(<App />);
137}
139if (typeof document !== "undefined") { client(); }
140141async function server(request: Request): Promise<Response> {
142const url = new URL(request.url);
143const { pathname } = url;
allvalsindexmain.tsx5 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45// Function to get a random emoji
6function getRandomEmoji() {
7const emojis = ['๐', '๐', '๐ค', '๐ป', '๐', '๐', '๐', '๐', '๐ก', '๐ฅ', '๐', '๐ฆ'];
8return emojis[Math.floor(Math.random() * emojis.length)];
9}
1011function App() {
12const [vals, setVals] = useState([]);
13const [error, setError] = useState(null);
79}
8081function client() {
82createRoot(document.getElementById("root")).render(<App />);
83}
85if (typeof document !== "undefined") { client(); }
8687async function server(request: Request): Promise<Response> {
88const { pathname } = new URL(request.url);
89
combinedEmeraldTunamain.tsx1 match
4import { currency } from "https://esm.town/v/stevekrouse/currency";
56export async function btcPriceAlert() {
7const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8let btcPrice = await currency("usd", "btc");
favouriteYellowShrewmain.tsx1 match
4import { currency } from "https://esm.town/v/stevekrouse/currency";
56export async function btcPriceAlert() {
7const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8let btcPrice = await currency("usd", "btc");
btcPriceAlertmain.tsx1 match
4import { currency } from "https://esm.town/v/stevekrouse/currency";
56export async function btcPriceAlert() {
7const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8let btcPrice = await currency("usd", "btc");
4import { currency } from "https://esm.town/v/stevekrouse/currency";
56export async function btcPriceAlert() {
7const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8let btcPrice = await currency("usd", "btc");