Are there any problems with this code?
export function escapeHtml(text: string): string {
return text
.replace(/</g, "<")
.replace(/&/g, "&")
.replace(/>/g, ">")
.replace(/"/g, """)| # This script also runs on the VPS. | |
| # It handles the bits that require | |
| # root access. | |
| set -e | |
| if [ $(id -u) != 0 ]; then | |
| echo "You're not root" | |
| exit 1 | |
| fi |
| function fnThatReturnsPromiseOrValue() { | |
| const random = Math.random(); | |
| if (random > 0.5) { | |
| return Promise.resolve(random); | |
| } else { | |
| return random; | |
| } | |
| } | |
| async function naive() { |
| import fs from "node:fs"; | |
| import path from "node:path"; | |
| import url from "node:url"; | |
| const cache = {}; | |
| function createRequire(filename) { | |
| function require(specifier) { | |
| const resolved = require.resolve(specifier); | |
| if (resolved in cache) { |
| import { createServer } from "node:http"; | |
| import { AsyncLocalStorage } from "node:async_hooks"; | |
| const asyncLocalStorage = new AsyncLocalStorage(); | |
| createServer((req, res) => { | |
| asyncLocalStorage.run({ req, res }, () => { | |
| asyncHandler().catch((err) => { | |
| console.error(err); | |
| if (!res.writableEnded) { |
| import { Dispatch, SetStateAction, useState, useEffect } from 'react'; | |
| export function usePersistentState<T>( | |
| key: string, | |
| defaultValue: T | |
| ): [T, Dispatch<SetStateAction<T>>] { | |
| const [state, setState] = useState<T>(defaultValue); | |
| // Save to session storage on unload | |
| useEffect(() => { |
| export function observable<T>(value: T): Observable<T> { | |
| const subscribers = new Set<(val: T) => void>(); | |
| function run(): T; | |
| function run(newValue: T): void; | |
| function run(updateFunction: (oldValue: T) => T): void; | |
| function run(newValueOrUpdateFn?: T | ((oldValue: T) => T)): T | void { | |
| if (newValueOrUpdateFn === undefined) { | |
| return value; | |
| } |
| interface RpcModules { | |
| "example-remote-module": MapReturnTypesToPromise< | |
| typeof import("example-remote-module") | |
| >; | |
| } | |
| export function importRemote<S extends keyof RpcModules>( | |
| module: S | |
| ): RpcModules[S] { | |
| return new Proxy({} as any, { |
| (function () { | |
| const ticks = Array.from( | |
| document.querySelectorAll("[aria-label='Verified account']") | |
| ) | |
| .filter( | |
| (tick) => | |
| tick?.parentElement?.parentElement?.children[0].textContent === | |
| "Elon Musk" | |
| ) | |
| .forEach((tick) => { |
| // Modern bir tarayıcıda https://www.turkiye.gov.tr/istanbul-buyuksehir-belediyesi-vefat-sorgulama | |
| // adresine gidip bu kodu developer console'a yapıştırarak çalıştırabilirsiniz. | |
| (function() { | |
| async function send(url, date) { | |
| let fd = new FormData(); | |
| fd.append("tarih", date); | |
| fd.append("token", document.body.dataset.token); | |
| fd.append("btn", "Sorgula"); |