Skip to content

Instantly share code, notes, and snippets.

View snuffyDev's full-sized avatar
😮‍💨
nice

snuffy snuffyDev

😮‍💨
nice
View GitHub Profile
import { LinkedList } from "$/collections/linkedlist";
import { SyncResult } from "$/types/util";
import { Maybe } from "$/collections/array";
export type Receiver<T> = {
subscribe: (cb: Subscriber<T>) => SyncResult<() => void>;
flush: () => T[];
try_flush: () => SyncResult<T[]>;
recv: () => T;
try_recv: () => SyncResult<T>;
#!/usr/bin/env node
import{readdirSync as pt,writeFileSync as lt}from"fs";import{homedir as mt}from"os";import{join as ut,resolve as A}from"path";import dt from"readline";var G=(...t)=>process.stdout.hasColors()?"\x1B[92m"+t[0]+"\x1B[39m":t[0];var D=(...t)=>process.stdout.hasColors()?"\x1B[104m"+t[0]+"\x1B[49m":t[0];var F=(...t)=>process.stdout.hasColors()?"\x1B[97m"+t[0]+"\x1B[39m":t[0];var x=(...t)=>process.stdout.hasColors()?"\x1B[1m"+t[0]+"\x1B[22m":t[0],l=(...t)=>process.stdout.hasColors()?"\x1B[2m"+t[0]+"\x1B[22m":t[0];var U=(...t)=>process.stdout.hasColors()?"\x1B[4m"+t[0]+"\x1B[24m":t[0],J=(...t)=>process.stdout.hasColors()?"\x1B[7m"+t[0]+"\x1B[27m":t[0];async function H(t){let o=process.stdout,n=process.stdin,s=dt.createInterface({input:n,output:o,completer:p=>{let d=p.lastIndexOf("/"),B=p.indexOf("/")?p.substring(0,d+1):"",it=p.substr(d+1),ct=A(B),I=pt(ct),y=I.filter(at=>at.indexOf(it)===0),S=[];return y.length===1&&S.push(B+y[0]+"/"),S.length?[S,p]:[y.length?y:I,p]}});s.write(`
`+(t?l("[GLOBAL] "):
const TOKENS = {
BACKTICK: '`',
HEADING: "#",
LEFT_BRACKET: "[",
RIGHT_BRACKET: "]",
OPEN_PAREN: "(",
NEW_LINE: '\n',
RIGHT_ANGLE_BRACKET: ">",
UNDERSCORE: "_",
CLOSE_PAREN: ')',
const mdParse=function(h){"use strict";const o={BACKTICK:"`",HEADING:"#",LEFT_BRACKET:"[",RIGHT_BRACKET:"]",OPEN_PAREN:"(",CLOSE_PAREN:")",TILDE:"~"},f=(n,u=[],k)=>{let _=u.length!==0?`<${n} `:`<${n}`;return u.length&&u.forEach(([l,A])=>{_+=`${l}=${A}`}),_+=`>${k}</${n}>`,_},K=n=>{let u=0,k=0,_=!1,l="";function A(t,e){function c(a){let i=0;for(let r=a+1;;r++)switch(n[r]){case o.BACKTICK:if(i>=2)return r+3;i++;break}}if(!(n[e+1]!==o.BACKTICK)&&!_){_=!0,u=e,k=c(u),_=!1;const a=n.slice(u,k);return l+=f("pre",[],f("code",[],a.slice(a.indexOf(`
`)+1,a.lastIndexOf("```")))),k}return g(t,e)}function g(t,e){function c(i){for(let r=i+1;;r++)switch(n[r]){case o.BACKTICK:return r+1}}const s=c(e);return l+=f("code",[],n.slice(e+1,s-1)),s-1}function d(t,e){function c(R){let C=0,b=0,I=0;for(let E=R+1;;E++)switch(n[E]){case o.LEFT_BRACKET:break;case o.RIGHT_BRACKET:C=E;break;case o.OPEN_PAREN:b=E;break;case o.CLOSE_PAREN:return I=E,{close_bracket:C,open_paren:b,close_paren:I}}}const{close_paren:s,open_paren:a,close_bracket:

Deployment

Prior to deploying: Within the project root directory there is a file named .env.EXAMPLE. There are two environment variables called VITE_DOMAIN and VITE_SITE_URL. Change "example.xyz" and "https://example.xyz" to your domain, then change the file name to .env. This is for the Content Security Policy.

Thanks to SvelteKit's use of adapters, deploying is simpler than ever.

By default Beatbump uses a custom Cloudflare Workers adapter, and is configured out of the box with Workers.

const r = {
BACKTICK: "`",
HEADING: "#",
LEFT_BRACKET: "[",
RIGHT_BRACKET: "]",
OPEN_PAREN: "(",
CLOSE_PAREN: ")",
TILDE: "~"
}, E = (n, u = [], f) => {
let _ = u.length !== 0 ? `<${n} ` : `<${n}`;
#!
// import { forEach } from './../src/collections/array/forEach';
// import { forEach } from './../src/collections/array/forEach';
import * as fs from 'fs';
import _path from 'path';
const BASE_PATH = _path.resolve('.');
const makePath = (...str: string[]) => _path.join(...str);
const TypeExport = /(?<=export (?:enum|type|interface)[\s]?)(\w+)/gm;
type DropdownItem = {
text: string;
icon: keyof typeof icons;
action: (...args) => void;
};
type Dropdown = DropdownItem[];
let DropdownItems: Array<{ text: string; icon: string; action: () => void }> = [
{
text: "View Artist",
icon: "artist",
action: async () => {
goto(`/artist/${item.artistInfo.artist[0].browseId}`);
await tick();
window.scrollTo({
behavior: "smooth",
top: 0,
import { setHandlers } from "./shared";
import type { DragEvent, Detail, GestureHandlers, PanEvent } from "./types";
import { dispatcher, addListener, boundingRect, calculateVelocity, removeListener, updateDetail } from "./utils";
export function pan(node: HTMLElement) {
const detail: Detail = { startTime: 0, timeStamp: 0, startY: 0, clientY: 0, deltaY: 0, velocityY: 0 };
const dispatch = dispatcher<PanEvent>();
const initialRect = { top: 0, height: 0, parentTop: 0 };