This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getHashSync = (str: string) => | |
String( | |
str.split("").reduce((s, c) => (Math.imul(31, s) + c.charCodeAt(0)) | 0, 0) | |
).replace(/-/g, ""); | |
const scriptStore: [Map<string, string>, Map<string, string>] = [ | |
new Map(), | |
new Map(), | |
]; | |
export const cleanShalimar = () => scriptStore.forEach((map) => map.clear()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default () => ({ | |
name: "deno_read", | |
setup(build) { | |
build.onLoad( | |
{ filter: /.*\.(t|j)s(x|)/, namespace: "file" }, | |
async ({ path }) => ({ | |
contents: await Deno.readTextFile(path), | |
loader: "tsx", | |
}) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type EventTargetWithAddListener = EventTarget & { | |
listeners: Map<string, any>; | |
addEventListener( | |
type: string, | |
listeners: Map<string, (event: Event) => any>, | |
options?: boolean | AddEventListenerOptions | |
): void; | |
}; | |
export const handleEventEmitter = ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const ReadableStream = window.ReadableStream && window.ReadableStream.prototype[Symbol.asyncIterator] ? | |
window.ReadableStream : (() => { | |
function ReadableStream (...args) { | |
let readers = [] | |
let obj = args[0] | |
let stream = new window.ReadableStream(...args) | |
// patch cancel to release lock | |
let _cancel = stream.cancel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from typing import List | |
import numpy as np | |
import pysbd | |
import torch | |
from TTS.config import load_config | |
from TTS.tts.models import setup_model as setup_tts_model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { h } from "preact"; | |
import { createContext, ComponentChildren } from "preact"; | |
import { useContext, useRef } from "preact/hooks"; | |
import { Signal, signal, useSignalEffect } from "@preact/signals"; | |
interface ComboboxProps { | |
children: ComponentChildren; | |
value: Signal<string>; | |
onChange: (value: string | null) => void; | |
nullable?: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { runHttpQuery } from 'https://deno.land/x/[email protected]/common.ts' | |
import type { GQLRequest, GQLOptions, GraphQLParams } from 'https://deno.land/x/[email protected]/types.ts' | |
import { renderPlaygroundPage } from 'https://deno.land/x/[email protected]/graphiql/render.ts'; | |
/** | |
* Create a new GraphQL HTTP middleware with schema, context etc | |
* @param {GQLOptions} options | |
* | |
* @example | |
* ```ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (fn, ms = 1000) => { | |
const connections = new Map(); | |
let id: number | undefined; | |
const poll = async () => { | |
if (connections.size > 0) | |
await fn().then((results) => | |
connections.forEach((conn) => conn(results)) | |
); | |
if (connections.size > 0) id = setTimeout(poll, ms); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { runHttpQuery } from 'https://deno.land/x/[email protected]/common.ts' | |
import type { GQLRequest, GQLOptions, GraphQLParams } from 'https://deno.land/x/[email protected]/types.ts' | |
import { renderPlaygroundPage } from 'https://deno.land/x/[email protected]/graphiql/render.ts'; | |
/** | |
* Create a new GraphQL HTTP middleware with schema, context etc | |
* @param {GQLOptions} options | |
* | |
* @example | |
* ```ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const range = (N) => [...Array(N).keys()]; | |
const outer = ([v1, v2]) => v1.map((x) => v2.map((y) => `${x}_${y}`)); | |
const tile = (N, fn) => | |
range(N).map((i, _, arr) => arr.slice(0, i).map(fn).join("+") || 0); | |
const layout = (N) => | |
outer([tile(N, (k) => `w${k * N}`), tile(N, (k) => `h${k}`)]) | |
.flat() | |
.join("|"); |