#🪅-progaming

1 messages · Page 134 of 1

supple whale
#

im trying to use it as a reference implementation and holy fuck react does NOT scale

#

this shit is impossible to navigate

fierce pendant
#

what react router do they use

supple whale
#

WISH I COULD FIND IT NOT GONNA LIE

#

thats how cancer it is to navigate

pseudo sierra
#

atp just ask the devs

#

you also get to tell them how much their shit sucks ass

supple whale
#

everything is stateful, everything relies on some state from some useeffect or useatom thats defined globally in one file, then referenced in 40 other files, and passed tru 200 components, and the atom states update somewhere 9 components deep

#

its CRAZY

pseudo sierra
#

HUSK

supple whale
#

like i cant even fucking load this shit because windows lags out

pseudo sierra
#

unreal

supple whale
#

THIS IS ONLY THE SOURCE CODE

#

NO NODE MODULES OR GIT

pseudo sierra
#

element devs banned from ever writing code again

gilded surge
#

true

supple whale
#

fucking generic react project moment

gilded surge
#

and not only is the code unreadable element doesn't even work

#

so all that code is worthless

pseudo sierra
#

react also banned from existing

signal wadi
#

is it bad that my node modules is over 1GB

#

i dont know what the fuck i did

supple whale
#

dont worry. element's is 1.4 gigs

signal wadi
#

has anyone put bad apple on telnet yet

#

because if not than im going to

supple whale
#

nvm its only a gig

pseudo sierra
unkempt ember
fierce pendant
signal wadi
#

using

#

ffplay on another window

pseudo sierra
#

if it can show images or play audio someone has played bad apple on it

signal wadi
#

mine is in rust

supple whale
signal wadi
#

actually

#

i made it able to use any.. yes ANY video as an input

#

looks like dogshit but

#

oh well

#

already built it for
aarch64-unknown-linux-musl
x86_64-unknown-linux-musl
x86_64-windows-something

#

perfectly 1MB

pseudo sierra
signal wadi
#

fuck it im doing it

#

does it even exist tho

pseudo sierra
#

yes

#

barely

signal wadi
#

holdon

fierce pendant
#

arent rust musl builds incredibly unoptimized

signal wadi
pseudo sierra
pseudo sierra
signal wadi
fierce pendant
#

true

signal wadi
pseudo sierra
#

I wish I had the time and effort to port some shit to sparc

fierce pendant
#

do you all know that feeling when youre sick and it feels like your neck has herpes on the inside

signal wadi
#

the actual playback starts at 1:30
first 1:30 is just server starting and setup

#

o yeah i have no idea why the percentage of converting is like that

#

and

#

i don't really gaf anymore

signal wadi
#

the problem at first was

#

the audio and video was not syncing

#

took me like 2 hours

#

and figured out the easiest way to fix that

#

which is don't provide the audio data to ffplay BEFORE the video starts

#

i know im dumb

fierce pendant
#

wha

signal wadi
#

i don't know

fierce pendant
#

we all use pascalCase right?

signal wadi
fierce pendant
#

i meant camelCase

#

not PascalCase

#

😭

signal wadi
#

brother

fierce pendant
#

sister

#

@supple whale guess repo

signal wadi
#

react

royal nymph
fierce pendant
signal wadi
#

yes

#

i would react

#

is that what you mean

signal wadi
fierce pendant
signal wadi
#

nah i would not

_ _

fierce pendant
signal wadi
#

nah i wont
_ _

fierce pendant
#

i think you will

_ _

signal wadi
#

nah i won't

_ _

fierce pendant
#

i will

_ _

signal wadi
#

you should

_ _

fierce pendant
#

what if i krill myself

signal wadi
#

no

#

i mean i do want to kms but still

#

no

fierce pendant
#

i didnt say kill myself

#

krill myself

signal wadi
#

grill myself

fierce pendant
#

ill turn into a rusteacean

signal wadi
fierce pendant
signal wadi
fierce pendant
signal wadi
fierce pendant
#

oh

dense sand
fierce pendant
dense sand
#

vencord

fierce pendant
supple whale
#

any cursed syntax enjoyers know if something like this is possible in js?

class Test {
  life = 42
  nested = {
    double: this.life * 2,
    quad: this.nested.store * 2
  }
}
unkempt ember
#

Nope you can't do this, because I believe, inside an object this context is not the same, the object make its own context.

#

After testing a bit in the REPL you can do something like this :

class Test
{
    life=42
    nested = () => {
        return {
            double: this.life * 2,
            quad: this.nested().double * 2
        }
    }
}

It works, if you omit this is recursive and throw a RangeError, nothing unsolvable.

#

Here it works because arrow functions does not have their own this context they borrow inherit it from their parents.

valid jetty
#

yeah you can use an arrow function, i dont think its possible to make it an iife unfortunately

#

ok you know what

#

you can do this

class Test {
  life = 42;

  nested = {
    get double() {
      return this._owner.life * 2;
    },
    get quad() {
      return this._owner.nested.double * 2;
    },
    _owner: null
  };

  constructor() {
    this.nested._owner = this;
  }
}
``` if you really want to have the interface of `test.nested.quad` or whatever
royal nymph
valid jetty
#

you can also do this

class Test {
  life = 42;

  nested = new Proxy({}, {
    get: (_, prop) => {
      const store = Reflect.get(this, 'life', this) * 2;

      if (prop === 'double') return store;
      if (prop === 'quad') return store * 2;
    }
  });
}

console.log(new Test().nested.quad)
#

i only ever have the best ideas

valid jetty
#

ok you know what

#

you can simplify it to this

class Test {
  life = 42;

  nested = new Proxy({}, {
    get: (_, prop) => {
      if (prop === 'double') return this.life * 2;
      if (prop === 'quad') return this.nested.double * 2;
    }
  });
}
``` and this actually is not that bad
#

the only reason this works is because the function that yields the value must be an arrow function, otherwise you could do it with getters instead but those act like full functions afaik with the this being within the object itself

#

and finally, so it looks more like an object:

class Test {
    life = 42;

    nested = new Proxy({}, {
        get: (_, prop) => {
            switch (prop) {
                case 'double': return this.life * 2;
                case 'quad': return this.nested.double * 2;
            }
        }
    });
}
#

WAIT

#

ok finally

class Test {
    life = 42;

    nested = new Proxy({}, {
        get: (_, p) =>
            p === 'double' ? this.life * 2 : 
            p === 'quad' ? this.nested.double * 2 : 
            undefined
    });
}
#

feels just like an object

deep mulch
#

rosie writing horrorcode

valid jetty
#

you could even do this

class Test {
    life = 42;

    nested = new Proxy({}, {
        get: (_, p, r) =>
            p === 'double' ? this.life * 2 : 
            p === 'quad' ? r.double * 2 : 
            undefined
    });
}
deep mulch
#

@valid jetty im taking class on linear algebra

valid jetty
#

awesome

deep mulch
#

you learned this at 10 years old though so im just doing the basics

valid jetty
deep mulch
#

@valid jetty

#

hiiii

valid jetty
#

hiiiii

supple whale
#

so you cant, ok

valid jetty
#

wdym you can

valid jetty
supple whale
#

and the boilerplate is horrific

#

I wanted to do that for DXA

#

so I can organize a massive class and have collapsible properties in it

deep mulch
#

@rosie.pie eep

tired vigil
signal wadi
#

how

#

aww no firefox?

fierce pendant
#

andrew tate my goat

frosty obsidian
#

sex trafficker btw

winged mantle
#

TIL here s is typed as string if noImplicitAny is true, otherwise it's implicitly any

let s;
if (true) {
    s = "foo";
}

fierce pendant
#

🔳

fleet cedar
supple whale
#

WE LOVE ENUMS


// this is likely overkill, but my brain is fried
// TLDR this needs to work with both TypedMatrixEvent<EventType.RoomPinnedEvents> and TypedMatrixEvent<'m.room.pinned_events'>, which is a bit of a nightmare to type

type EventTypeLike = EventType | `${EventType}`

type ResolveStateEventKey<T extends EventTypeLike | keyof StateEvents> = {
  [K in keyof StateEvents]: T extends K ? K : T extends `${K & string}` ? K : never
}[keyof StateEvents]

type StateEventContent<T extends EventTypeLike | keyof StateEvents> = ResolveStateEventKey<T> extends never
  ? IContent
  : (StateEvents[ResolveStateEventKey<T>] & IContent)

export interface TypedMatrixEvent<T extends EventTypeLike | keyof StateEvents = EventType> extends MatrixEvent {
  getType: () => T
  getContent: <Z extends IContent = StateEventContent<T>>() => Z
}
#

@jade stone

fierce pendant
ionic lake
supple whale
#

thats not what i'm doing

#

im mapping an enum, or that enum as a string, to a property map

fierce pendant
#

yes i just wanted to show my cursed typescript types

dense sand
#

using bun --bun dev in my nextjs project causes HMR to be like 100x slower

#

cant figure out why

#

oh wait its bun

jade stone
#

yop

#

bun sucks

jade stone
deep mulch
#

@jade stone loves bun

fierce pendant
#

@jade stone loves bun

jade stone
#

husk

noble gazelle
#

hello

#

i need help with something

#

i have a a question about a plugin

#

@jade stone

jade stone
#

vns

elder yarrowBOT
noble gazelle
# jade stone vns

so basically is there a plugin that always shows the username overlays while your in call yk the ones that when you hover over a discord call they show everyones name

noble gazelle
#

ill see you on the flip side

slim rose
jade stone
#

@calm ruin new feature

calm ruin
#

how does it download

#

via zip

jade stone
calm ruin
#

TAR BAD

supple whale
#

@jade stone make me a version of vencord that has calls and nothing else

calm ruin
#

ZIP

supple whale
#

like the entire app is just voice channels and nothing else

#

XD

#

i'll put a $5 bounty on it

jade stone
supple whale
#

no, see, teamspeak doesnt work with people connected to discord channels

#

if u manage to make some webrtc proxy, where u can connect to discord channels from my own webrtc instance i'll suck like 2 dicks tho

#

and $50

#

XD

jade stone
#

@supple whale downloading file over websocket instead of streaming it over http ❤️

jade stone
supple whale
#

BASE64 ENCODED AS WELL?!

#

BRO, WEBSOCKET IS A HTTP SERVER!!!!!!!!!!

#

AND WEBSOCKET SUPPORTS BINARY DATA

#

U DONT NEED TO SERIALIZE IT!!!!!!

calm ruin
#

satan doing it worst way possible

jade stone
#

yop

supple whale
#

YOU DONT EVEN STREAM IT TO A FILE

calm ruin
#

satan what if you made it to mp4 and streamed it using hsl

supple whale
#

YOU STREAM IT TO MEMORY

#

HOLY FUCK

supple whale
#

but no call support.

jade stone
#

i should probably call this too @supple whale

supple whale
#

i mean

jade stone
supple whale
#

then

await writable.write(contents);

// Close the file and write the contents to disk.
await writable.close();
supple whale
#

same for safari

dense sand
stuck dragon
#

I hate new components

supple whale
# supple whale WE LOVE ENUMS ```ts // this is likely overkill, but my brain is fried // TLDR t...

holy shit, 9 prompts later:

type ContentEvents = StateEvents & TimelineEvents & AccountDataEvents & RoomAccountDataEvents

type EventTypeLike = EventType | `${EventType}` | keyof ContentEvents

export interface TypedMatrixEvent<T extends EventTypeLike = EventTypeLike> extends MatrixEvent {
  getType: () => T
  getContent: <Z = ContentEvents[Extract<keyof ContentEvents, T | `${T & EventType}`>] & IContent>() => Z
}
#

AI actually goated for this kind of "simplify my TS types" shit

#

that said i went tru 20% of my monthly quota for copilot XD

#

the fact that TS doesnt have

if (event.type === 'custom'): event is CustomEvent {

}

guards is crazy doe

#

and u need an util function in there, which is disgusting

jade stone
supple whale
#

yes but no

#

because if i do type === then sure

#

but getType() === then no

#

:))))

jade stone
#

well yeah

supple whale
#

WELL WHY

jade stone
#

typescript can't know functions are pure

supple whale
#

how can i fix that D:

jade stone
supple whale
#

well its not my method

jade stone
#

oh

supple whale
#

i'm overriding a library's types

jade stone
#

idk then blobcatcozy

supple whale
#

which were attrocious and non-functional

eternal gust
royal nymph
#

peak

jade stone
#

@deep mulch help

deep mulch
#

how

jade stone
deep mulch
#

NOP

jade stone
#

you love boxing

pseudo sierra
#

husk

winged mantle
#

java doesn't have string boxing afaik

#

i think kotlin has its own string though which it implicitly converts the java string to

jade stone
#

forgot strings aren't primitives in java

#

just literals

deep mulch
#

yes

#

primitives get auto unboxed by kotler compiler if possible

jade stone
#

@deep mulch

royal nymph
#

js primitive classes are mostly useless

crimson sparrow
signal wadi
fierce pendant
lavish cloud
lavish cloud
runic sundial
#

It does

lavish cloud
#

yes

#

I'm too scared of vulkan

pseudo sierra
#

smh

fierce pendant
#

what if i made a game engine in js smh

winged mantle
lavish cloud
#

I mean yeah it does define some extensions

supple whale
#

there's plenty of appeal for it

#

problem is, your 2 options are opengl ES3.0

#

or webgpu which is a 2015 version of vulkan

#

with little browser and device support

jade stone
supple whale
#

yeah chrome had it but removed it due to fingerprinting

#

questionable af

royal nymph
#

I had it at some point in chromium

#

I didn't realise they removed it again

#

Oh wait no that's for themeing user agent styled elements like inputs with your accent colour, i think it still has that

royal nymph
#

since there are so many colours and it'll be different for each user if they use wallpaper colours

pseudo sierra
#

you could probably limit that by having just some 32 colours and choose the closest one for websites

winged mantle
#

me learning how webpack patching works

#

🪤

ionic lake
winged mantle
#

why is it the case that getting the cache on discord is as easy as getting the c property on the require function

pearl stagBOT
supple whale
#

that can simply be applied to anything

jade stone
#

also i love pnpm for having a patching system

#

best thing ever

ionic lake
supple whale
jade stone
supple whale
deep mulch
royal nymph
winged mantle
#

ohh that makes sense

royal nymph
#

ye they do

royal nymph
#

i wonder what webpack does if you do like

require["CACHE".toLowerCase()]
winged mantle
#

wouldn't it be better to use the prototype pollution trick in case discord stops doing this

jade stone
#

lovely description

winged mantle
#

ModuleConcatenationPlugin seems like a pita for modding

deep mulch
#

@jade stone SLOPPY SADANNN

#

Sadan is Slopmaxxing

winged mantle
#

simply make a version of findByCode which searches every single function every declared even if not exported

#

wait what if there was a function which registered the search string and then returned a proxy which later forwards to the function once it's found by parsing the javascript of each module that is loaded, finding function syntax nodes and if their body contains the string surrounding them with an assignment

#

genius

jade stone
#

thank god discord has it disabled

winged mantle
#

ah so that's why it's not common you need a patch just to access a function

jade stone
winged mantle
#

yeah

jade stone
#

yeah, i only know of once place off the top of my head were we do that

winged mantle
#

because there are no exported functions which webpack made unexported with module concatenation

#

imagine if discord enabled this

jade stone
#

i'd rather not

#

there are also reasons to not enable it

winged mantle
#

easy way to end client mods? though I guess it doesn't make anything impossible maybe just really annoying blobcatcozy

jade stone
#

(it would probably be a headache to debug in prod)

#

no breakpoints trolley

#
  • idk how source maps would work with that
winged mantle
#

fluxer has source maps and uses file paths for module ids in prod

#

oh as well as module concatenation

#

the source maps do work

jade stone
#

how do they work with breakpoints

winged mantle
#

uh

#

i can't get chromium to show the mapped sources

#

it was working in firefox

#

or wait no ..

#

I think I only saw it work in chromium

#

guh

#

oh they're under fluxer_app I am stupid

#

how do breakpoints work? they just do lol

jade stone
#

TIL typescript doesn't consider the mutability of properties in assignments

valid jetty
#

why would it....?

#

it would break going the other way around

#

an object with a readonly bar is a subset of the object of the mutable bar

#

im pretty sure if you tried to do myReadOnlyFoo = myFoo it would throw an error

jade stone
#

nope

jade stone
winged mantle
#

to really spell it out:

dreamy shard
#

Man, this fake mute and deafen is making me rage atp. I'm trying to make it have a reasonable place where to be but I still can't find any that's valid.

valid jetty
#

a fake mute and deafen plugin sounds really creepy

winged mantle
#

I think this illustrates it well because a mistake you might make is passing a readonly thing to a function that expects to be able to mutate it

#

also when you do it with arrays suddenly the situation is different

#

TS is weird

dreamy shard
#

I'm just making it for trolling and not distributing it .,.

deep mulch
#

@valid jetty hiii

#

Ro ie

jade stone
#

@deep mulch @pearl parrot more great code

#
function computeRectClipOffsets( 
     el: DOMRectReadOnly, 
     bounds: DOMRectReadOnly, 
     avoid: Pick<DOMRectReadOnly, "top" | "bottom" | "left" | "right">, 
 ): [RectOffset, mapper: Record<TooltipPosition, TooltipPosition>] { 
     let mapper: Record<TooltipPosition, TooltipPosition> = MAPPER_NOOP; 
  
     if (rectFullyContainedBy(el, bounds)) { 
         return [NO_OFFSET, mapper]; 
     } 
  
     let top = 0; 
  
     if (rectHeightCanBeContainedBy(el, bounds)) { 
         // too far up 
         if (el.top < bounds.top) { 
             if (avoid.bottom > bounds.top) { 
                 mapper = MAPPER_FLIP; 
             } 
             top = Math.max(bounds.top, avoid.bottom) - el.top; 
         // too far down 
         } else if (el.bottom > bounds.bottom) { 
             if (avoid.top < bounds.bottom) { 
                 mapper = MAPPER_FLIP; 
             } 
             top = Math.min(bounds.bottom, avoid.top) - el.bottom; 
         } 
     } 
  
     let left = 0; 
  
     if (rectWidthCanBeContainedBy(el, bounds)) { 
         // too far left 
         if (el.left < bounds.left) { 
             if (avoid.right > bounds.left) { 
                 mapper = MAPPER_FLIP; 
             } 
             left = Math.max(bounds.left, avoid.right) - el.left; 
         // too far right 
         } else if (el.right > bounds.right) { 
             if (avoid.left < bounds.right) { 
                 mapper = MAPPER_FLIP; 
             } 
             left = Math.min(bounds.right, avoid.left) - el.right; 
         } 
     } 
  
     return [ 
         { 
             top, 
             left, 
         }, 
         mapper, 
     ]; 
 }
pearl parrot
elder yarrowBOT
# pearl parrot vdumbai what does that do

The function computeRectClipOffsets calculates the offsets for a rectangle clip based on a given el and bounds. It checks if the el is fully contained within the bounds, and if so, returns a mapping that flips the top and left offsets. Otherwise, it checks if the el is fully contained within the bounds, and if so, flips the top and bottom offsets. If the el is not fully contained, it checks if the el is fully contained within the bounds, and if so, flips the left and right offsets.

-# Response generated by gemma-3-1b-it. AI may be incorrect or misleading.

royal nymph
elder yarrowBOT
royal nymph
#

oooh

jade stone
royal nymph
elder yarrowBOT
royal nymph
frosty obsidian
#

jumpscare

solemn ravine
#

🔥 Features

jade stone
#

Whats with that magic string

supple whale
#

@jade stone wanna see sex?

#

holy i sex'ed all over the floor u should see the stain

jade stone
#

Insane

clever musk
#

SEX!

supple whale
# jade stone Insane
<script lang='ts'>
  import type { ImageContent } from 'matrix-js-sdk/lib/types'

  import { mxcToHttp } from '$lib/modules/matrix/event'

  export let content: ImageContent & { info?: { ['xyz.amorgan.blurhash']?: string } }

  $: name = content.filename ?? content.body
  $: src = mxcToHttp(content.url ?? content.file!.url, content.file)
  $: size = content.info?.size ?? 0
  $: width = content.info?.w ?? 0
  $: height = content.info?.h ?? 0
// $: blurhash = content.info?.['xyz.amorgan.blurhash']
</script>

({width}x{height}, {Math.round(size / 1024)}KB)
<img {src} alt={name} class='h-full' />

and

export function mxcToHttp (mxc: string, encrypted?: EncryptedFile) {
  const url = getHttpUriForMxc(
    get(wellknown)!['m.homeserver']!.base_url!,
    mxc,
    undefined,
    undefined,
    undefined,
    true,
    true,
    true
  )

  if (!encrypted || !url) return url || mxc

  // Encode encrypted file metadata in search params
  const urlObj = new URL(url)
  for (const [key, value] of Object.entries(encrypted)) {
    urlObj.searchParams.set(key, JSON.stringify(value))
  }
  return urlObj.toString()
}
#

so i have a component for rendering a file

#

simple enough right

#

but the file is ENCRYPTED TO SHIT

#

which is why i pass the encryptedfile object as search params

#

encryptedfile:

#

then in a service worker i do:

function isMatrixMediaRequest ({ origin, pathname }: URL): boolean {
  if (origin !== baseUrl?.origin) return false

  return pathname.startsWith('/_matrix/client/v1/media/') || pathname.startsWith('/_matrix/media/v3/')
}

const DESTINATIONS = new Set(['image', 'video', 'audio'])

registerRoute(
  ({ url, request }) => {
    if (!DESTINATIONS.has(request.destination) || !accessToken || !baseUrl) return false

    return isMatrixMediaRequest(url)
  },
  async ({ url, request }) => {
    if (!accessToken) return await fetch(request)

    const headers = new Headers(request.headers)
    headers.set('Authorization', `Bearer ${accessToken}`)

    const hasParams = url.search.length > 1

    const encryptedParam = Object.fromEntries(url.searchParams.entries().map(([key, value]) => [key, JSON.parse(value)])) as EncryptedFile
    for (const param of url.searchParams.keys()) url.searchParams.delete(param)

    url.searchParams.set('allow_redirect', 'true')

    const res = await fetch(url, {
      ...request,
      headers,
      cache: 'default'
    })

    if (!hasParams) return res

    return new Response(await decryptAttachment(await res.arrayBuffer(), encryptedParam), res
    )
  }
)
#

so file is decrypted before it ever reaches the app itself

#

and now that i have it as a "response" in a service worker i can do service worker things with it like caching etc

#

decryptattachment is fun:

#

generic web crypto shit XD

jade stone
#

Insanity

supple whale
#

"simple web app" moment

#

XD

solemn ravine
#

its already updated

supple whale
#

and how fucking clean it is

#

and how powerful

#

0 load in the UI, AND i can cache this shit, AND its super smart

jade stone
#

All I did today is improve my tooltip component

supple whale
#

i havent coded all day

jade stone
#

Before

supple whale
#

went out

jade stone
supple whale
#

ate to much fucking sushi its nuts

supple whale
#

i wish you simply used the popover API for this

#

would have handled that for u lmao

jade stone
supple whale
#

and not tooltip?....

#

breugh

jade stone
#

Also use it for my popout component lol

royal nymph
#

single quote string for an html attribute blobcatscared

#

(yes it's svelte but still)

jade stone
supple whale
#

TS, CSS, HTML

#

EVERYWHERE

jade stone
#

I only use double quotes

#

Force of habit because of Java, c, cpp, rust, etc...

royal nymph
#

single quote is for chars

supple whale
#

i used it for 1 single paper, for which i wrote 30 LOC

royal nymph
supple whale
#

yeah honestly

#

idfk what github is cooking there

#

because i dont have any rust repos

#

honestly turbo confused about that too

royal nymph
supple whale
#

💀

#

that shit has that much wasm?

royal nymph
#

400kb of generated rust

supple whale
#

fuck me i imported 1 lib and it has more code than all my js combined?

#

fuck me....

#

fuck native!

royal nymph
#

u pushed the build folder lmao

#

i wonder if it's counting anything in here

supple whale
#

yeah cuz its wasm

#

there made that priv

#

hopefully it wont count when it updates next week

jade stone
supple whale
#

isnt there like a "root" or "relative" thingy for those now?

jade stone
supple whale
#

try it

#

actually curious

jade stone
#

I got rid of it because Firefox didn't support anchor positioning

#

Might bring it back

supple whale
#

do it then teach me

#

i want to learn anchor positioning to decide if its better than floating-ui libs

jade stone
#

Soon

royal nymph
#

I fixed it with js

supple whale
#

vs libs?

#

or libs are bad?

jade stone
royal nymph
jade stone
royal nymph
#
const POPOVER_VIEWPORT_PADDING = 8;

export function Popover(props: PropsWithChildren<{ renderPopover: () => React.ReactNode; focusRing?: boolean }>) {
    const { renderPopover: PopoverContent, focusRing = false, children } = props;

    const id = useId();

    const [shouldRender, setShouldRender] = useState(false);
    const [open, setOpen] = useState(false);
    const popoverRef = useRef<HTMLDivElement>(null);

    const onToggle: ToggleEventHandler = e => {
        setOpen(e.newState === "open");
        if (e.newState === "closed") setShouldRender(false);
    };
    const onBeforeToggle = () => {
        setShouldRender(true);
        if (popoverRef.current) popoverRef.current.style.opacity = "0";
    };

    useLayoutEffect(() => {
        if (!open) return;

        const el = popoverRef.current;
        if (!el) return;

        el.style.translate = "";
        const rect = el.getBoundingClientRect();

        let translateX = 0;
        let translateY = 0;

        if (rect.right > window.innerWidth - POPOVER_VIEWPORT_PADDING) {
            translateX = window.innerWidth - rect.right - POPOVER_VIEWPORT_PADDING;
        }
        if (rect.left < POPOVER_VIEWPORT_PADDING) {
            translateX = POPOVER_VIEWPORT_PADDING - rect.left;
        }
        if (rect.bottom > window.innerHeight - POPOVER_VIEWPORT_PADDING) {
            translateY = window.innerHeight - rect.bottom - POPOVER_VIEWPORT_PADDING;
        }
        if (rect.top < POPOVER_VIEWPORT_PADDING) {
            translateY = POPOVER_VIEWPORT_PADDING - rect.top;
        }

        el.style.translate = `${translateX}px ${translateY}px`;
        el.style.opacity = "1";
    }, [open]);

    return (
        <>
            <Clickable popoverTarget={id} className={classNames(focusRing && "focusRing")}>
                {children}
            </Clickable>
            <div
                popover="auto"
                id={id}
                ref={popoverRef}
                className={styles.popover}
                onToggle={onToggle}
                onBeforeToggle={onBeforeToggle}
            >
                {shouldRender && <PopoverContent />}
            </div>
        </>
    );
}
#

this is what I used for positioning popovers trolley

#

and css

.popover {
    position-area: bottom;
    position-try-fallbacks: top;
    margin: initial;
    padding: 1em;
    border-radius: 8px;
    background: var(--bg2);
    border: 1px solid var(--shadow);
    box-shadow: 0 4px 12px var(--shadow);

    &:popover-open {
        display: block;
    }
}
#

that useLayoutEffect is vibe coded cause I couldn't be arsed but it works well

signal wadi
#

uh guys

#

i kinda ported minecraft to discord

jade stone
signal wadi
royal nymph
#

but they still go off screen

#

idt there's a way to fix that without js

jade stone
#

I'll send when I get home

royal nymph
#

black is the page
red is the popover parent
green is the popover

#

that hook makes it like this instead

#

but still properly centred if possible

supple whale
#

thank you for coming to my ted talk

#

--left would be your actual position

#

but idk how that computes with popover api

jade stone
#

@royal nymph this is what i made when i made tooltip with css anchors

not sure if you can use a custom element instead of the viewport

#

if you don't want the animations you can do this with 0 js i think

supple whale
#

@jade stone did i ever mention how much i fucking LOVE WORKBOX?!?!?!

registerRoute(
  ({ url, request }) => {
    if (!DESTINATIONS.has(request.destination)) return false

    return PATHNAMES.some(path => url.pathname.startsWith(path))
  },
  new CacheFirst({
    cacheName,
    plugins: [
      {
        async requestWillFetch ({ request }) {
          const awaited = await session
          if (!awaited) return request
          const url = new URL(request.url)
          const headers = new Headers(request.headers)
          headers.set('Authorization', `Bearer ${awaited.accessToken}`)

          const hasParams = url.search.length > 1
          const encryptedParam = Object.fromEntries(url.searchParams.entries().map(([key, value]) => [key, JSON.parse(value)])) as EncryptedFile

          // Strip encrypted params from URL before sending to server
          for (const param of url.searchParams.keys()) url.searchParams.delete(param)
          url.searchParams.set('allow_redirect', 'true')

          if (hasParams) encryptedParamsCache.set(url.toString(), encryptedParam)

          return new Request(url, { ...request, headers })
        },
        async fetchDidSucceed ({ response, request }) {
          const encryptedParam = encryptedParamsCache.get(request.url)
          encryptedParamsCache.delete(request.url)

          if (!encryptedParam) return response

          // needs spread operator, otherwise things break
          return new Response(await decryptAttachment(await response.arrayBuffer(), encryptedParam), { ...response })
        }
      },
      new RangeRequestsPlugin(),
      new CacheableResponsePlugin({ statuses: [0, 200] }),
      new ExpirationPlugin({ maxEntries: 20, maxAgeSeconds: 7 * 24 * 60 * 60 })
    ]
  })
)
#

I MEAN HOLY FUCK IMAGINE TRYING TO DO THIS YOURSELF

#

just fucking

#

new RangeRequestsPlugin(),
new CacheableResponsePlugin({ statuses: [0, 200] }),
new ExpirationPlugin({ maxEntries: 20, maxAgeSeconds: 7 * 24 * 60 * 60 })

#

'ed that bitch

#

JESUS IT FUCKS

jade stone
#

insane

#

@calm ruin who needs fancy css to prevent word breaking when you can just use NBSP

supple whale
jade stone
supple whale
#

all message types implemented!

jade stone
#

@supple whale TIL the android back button/gesture will attempt to pop the top popover off the stack before attempting to navigate

deep mulch
jade stone
deep mulch
fierce pendant
supple whale
#

matrix spec: so for attachment encryption, lets support a streamable, seekable encryption algortihm, that way there's no upper limit of the attachment size!
EVERY SINGLE MATRIX CLIENT: src = URL.createObjectURL(fetch().blob())

#

god why are web devs so inept

dense sand
#

okay guys i have pro tip for yall

#

never make yourself write your final work at school in nextjs

pseudo sierra
supple whale
#

always go the path of least resistance and less effort

#

more effort is never rewarded in work or school

dense sand
#

look, in september i had a different idea about next

supple whale
#

i did the ABSOLUTE BARE FUCK MINIMUM in uni, and got a 100% on my thesis, and a 96% grade average

#

and thats doing as fucking little as possible, attending as little classes, and putting as little effort into the paper as possible

#

the code for my paper was like 40 LOC in total

#

the excell spreadsheets were more work than the code!

#
use wasm_bindgen::prelude::*;
use sha2::{Sha256, Digest};

#[wasm_bindgen]
pub fn sha2(data: &[u8]) -> Vec<u8> {
    let mut hasher = Sha256::new();
    hasher.update(data);
    hasher.finalize().to_vec()
}
use wasm_bindgen::prelude::*;
use flate2::{Compression, write::GzEncoder, read::GzDecoder};
use std::io::prelude::*;

#[wasm_bindgen]
pub fn gzip_compress(data: &[u8]) -> Vec<u8> {
    let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
    encoder.write_all(data).unwrap();
    encoder.finish().unwrap()
}

#[wasm_bindgen]
pub fn gzip_decompress(data: &[u8]) -> Vec<u8> {
    let mut decoder = GzDecoder::new(data);
    let mut result = Vec::new();
    decoder.read_to_end(&mut result).unwrap();
    result
}
wasmBench.add(`${size}`, () => {
    return wasmGzip.gzip_compress(data)
  })
compressionStreamBench.add(`${size}`, async () => {
    const { writable, readable } = new CompressionStream('gzip')
    const writer = writable.getWriter()
    
    writer.write(data)
    writer.close()
    
    return await new Response(readable).arrayBuffer()
  })
pakoBench.add(`${size}`, () => {
    return pako.gzip(data)
  })
#

thats all the code from my master's thesis

#

XD

dense sand
#

oh wow

supple whale
#

i probably spent more time thinking about what to write about so that its as little effort as possible

#

than i actually did writing the code

#

writing the paper was ass tho, so much uni speak

dense sand
#

yea atp i spent more time deploying the project than working on it

fierce pendant
supple whale
#

SVELTE

dense sand
#

so im forced to use next

fierce pendant
supple whale
#

SVELTEKIT

#

but yeah it is

fierce pendant
supple whale
#

svelte is also a framework

#

your definition of framework is ass, because you think about it as a UI framework + router

#

clearly.

dense sand
#

ive given up on this so im just hardcoding the variables into the build files

#

im just so tired about this

supple whale
#

and i'm implementing AES-CTR decryption in web streams

dense sand
#

shouldve chosen tanstack start...

supple whale
#

so i can do

return new Response(response.body?.pipeThrough(createDecryptionStream(encryptedParam, 0)) ?? response.body, {
  status: response.status,
  statusText: response.statusText,
  headers: responseHeaders
})
dense sand
#

im never making this mistake again

pseudo sierra
#

which one there's like a dozen so far

dense sand
#

😭

#

ideally all of them

fierce pendant
pseudo sierra
#

A software framework is software that provides reusable, generic functionality which developers can extend or customize to create complete solutions.

fierce pendant
#

okay so

#

what if i wanna use svelte

#

without vite

dense sand
#

vai whats framework

elder yarrowBOT
# dense sand vai whats framework

A framework is a pre-defined, reusable software structure that provides a foundation for building applications. It typically includes libraries, tools, and guidelines to streamline development by offering common functionalities and patterns.

-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.

pseudo sierra
#

stfu Nerd I just copied that from wikipedia

#

kms

supple whale
dense sand
#

vai difference between library and framwork

elder yarrowBOT
# dense sand vai difference between library and framwork

The key difference between a library and a framework lies in who controls the flow of execution, often referred to as "Inversion of Control" (IoC).

  • Library: You, the developer, are in control. You decide when and where to call specific functions or classes from the library to perform specific tasks. Libraries are typically designed for a focused scope, like handling dates or making HTTP requests.
  • Framework: The framework dictates the overall structure and flow of your application. You write your code to fill in the gaps or conform to the framework's conventions, and the framework then calls your code when needed. Frameworks provide a comprehensive foundation for building entire applications.

In essence, your code calls a library, but a framework calls your code.

-# Response generated by gemini-2.5-flash. AI may be incorrect or misleading.

dense sand
#

im not even gonna mention this

#

sigh

fierce pendant
dense sand
#

WHY DOES THE NORMAL BUILD WORK BUT DOCKER FAILS

pseudo sierra
dense sand
#

BRO WHAT

pseudo sierra
#

mewhenthe vibecoded js runtime is actually shit

#

who could have seen this coming

#

well clearly not you

fierce pendant
#

i mean

#

it works for me

dense sand
#

as i said

#

it works in normal build

#

but fails in docker

#

why? who knows

fierce pendant
#

just use like

#

deno in docker

dense sand
#

i just bun specific shit

pseudo sierra
fierce pendant
#

no seriously

#

whats wrong with using bun if it doesnt segfault for me

jade stone
#

there's nothing wrong with using it per se; however, there are a plethora of issues that make it terrible.

jade stone
#

@supple whale blobcatcozy
i love template literal types

pseudo sierra
#

you love shithub just not showing line numbers randomly

fierce pendant
jade stone
#

in this case, start with react-hooks/

#

you can do things like ${"foo" | "bar"}${"1" | "2"} which is the same as "foo1" | "foo2" | "bar1" | "bar2"

fierce pendant
solid gazelle
sour wing
jade stone
#

i love magic numbers

sour wing
#

being only 14ms slower than nodejs, and by extension v8 is a pretty huge win imo

jade stone
#

are you aot, jit or interpreted

sour wing
#

I have an interpreted mode but it takes about 2 seconds for bytecode and 6 for raw ast lmao

jade stone
#

send repo

fierce pendant
#

i just jit my pants

sour wing
#

well i have the base language stuff on github, but no bytecode/jit stuff

jade stone
#

@sour wing can you bench your lang without jit against node --jitless

sour wing
#

i can't get on my pc right now 😭
I did compare against python without jit though, and they took about 660ms

#

with jit it took a bit longer, but pypy with an actually good jit took 80 something ms

jade stone
#

what are you using as a backend for the jit wires

jade stone
#

also TIL PCRE2 JITs regex

sour wing
#

oh yeah my language doesn't have regex support yet
i need that

#

depending on yet another dependency is kinda sad, but my ass is not writing a regex interpreter

pseudo sierra
#

also it happens at semi random and gets fixed by refreshing (sometimes)

supple whale
#

@royal nymph you'll probs like this too

pseudo sierra
#

very cool

deep mulch
#

has anyone here used daisyui

pseudo sierra
#

the fuck is that

deep mulch
#

thing

lucid trail
jade stone
#

help

#

caniuse blobcatcozy

#

oh, thanks MDN

deep mulch
#

too many

#

they should remove like 500

supple whale
#

it simply needs UI

#

it has NONE

solemn ravine
#

@pseudo sierra I managed to make my own nar ripoff

#

no compression

fierce pendant
valid jetty
#

@deep mulch

#

i did it are you proud

austere idol
#

THIS IS THE MOST BEAUTIFUL WAY TO FREE EVERYTHING

valid jetty
#

i mean

#

its literally just an arena allocator

#

the humble

fierce pendant
#

test

#

okay

#

thank you proton vpn

woven mesa
#

meow

winged mist
#

What is this chat even abt lol

winged mist
winged mantle
winged mist
deep mulch
#

pro gaming

deep mulch
#

@pseudo sierra bwa

pseudo sierra
#

@deep mulch bwa

jade stone
#

TIL discord uses floating-ui

fierce pendant
winged mantle
#

imagine if printf had nodiscard

fleet cedar
#

Printf isn't void?

winged mantle
#

says average professional c developer, probably

ivory heath
#

returns the number of printed character or < 0 if it failed which is more common than one would think

fleet cedar
#

I'm a professional c++ dev though, I don't use printf

fierce pendant
queen jasper
winged mantle
#

I feel like I may have been converted to no syntax highlighting

#

am I sane

fierce pendant
#

fuck it

#

im making another javascript framework

#

why husk

#

the framework will make use of many web bun standards

winged mantle
#

I immediately switched away from bun after anthropic

fierce pendant
winged mantle
#

tbh i wouldn't want to rely on bun specific apis

fierce pendant
#

ill use standard fetch handlers

winged mantle
#

why don't you use bun's builtin c compiler to use libcurl

fierce pendant
#

why would i do that

#

that sounds incredibly sinful

#

this framework is gonna be like god intended

valid jetty
#

im pretty sure the number returned is the number of characters successfully written to stdout

winged mantle
#

meanwhile cout << just returns the same object and you need to call othr functions to check errors 😭

#

cout feels like a bit of a backwards design compared to c's IO stuff in many ways

valid jetty
#

why do you think they added the print module to the stdlib

#

(and that just copies rust too lol)

winged mantle
#

what did people even do to get around formatting side effects in older c++ though...

valid jetty
#

wdym

winged mantle
#

i tried writing a raii wrapper for std::hex but it was ugly

winged mantle
# valid jetty wdym

if you do something like this std::cout << std::hex << 10; all future prints of numbers will be in hex - you need to remember std::dec

valid jetty
#

thats how you print hex using that??? that's awful

winged mantle
#

yeah

valid jetty
#

std::hex was a pyramid scheme to sell you std::hexOnce

#

or i guess std::hex_once

winged mantle
#

I feel the temptation to create my own standard library but it wouldn't be very standard then...

#

😭

valid jetty
#

many times

winged mantle
#

somehow i find it hard to find things that replace the c++ stdlib instead of augment it

#

there probably hasn't been a big project doing that because it'd be bad for interop

valid jetty
#

boost, eastl, asl

#

among others

winged mantle
#

don't those augment it instead of replacing it

#

you mean abseil right? asl doesn't seem to be a popular thing

#

literally says

Abseil is an open-source collection of C++ code (compliant to C++17) designed to augment the C++ standard library.

#

eastl also doesn't reimplement iostream stuff

#

I'm thinking, what if you could avoid linking to the c++ standard library at all (maybe just the c library stuff to make implementing an alternative standard library easier)

#

something i find annoying about c is you usually end up writing your own dynamic array/hash table for half the projects you do and that also happens with c++ if you avoid the standard library

#

templates are a pretty killer feature though at least you're unlikely to end up implementing a hash table multiple times in the same project blobcatcozy

fierce pendant
#

my javascript runtime is solidphobic 😔

#

i am trying to use solid but it just decides to use react 😔

#

😔

winged mantle
#

first-world high-level problem

fierce pendant
#

guess ill have to use react then blobcatcozy

valid jetty
winged mantle
#

ah this is what came up

#

that heavily depends on the C++ standard library too though..

jade stone
deep mulch
#

@valid jetty hiiii

valid jetty
#

hiiiii

winged mantle
supple whale
#

@jade stone any recommendations for code preview

#

for stuff like

const x = 'test'
#

in my own markdown editor?

jade stone
#

Idk

supple whale
#

yeah no i need rendering

#

i have a string code and i need output html

#

thats syntax highlighted

#

read-only, not editable

jade stone
#

Shiki can do that

supple whale
#

ok thx

jade stone
#

Or it can output to hast

supple whale
#

can u link me the lib?

#

or is it just shikicodeblocks on npm?

jade stone
supple whale
#

ic its just shiki

jade stone
supple whale
pearl stagBOT
deep mulch
#

@jade stone

frosty obsidian
valid jetty
#

where are the leaks

frosty obsidian
#

i have them actually but can't send bc tos ykyk

#

you should be able to find them easily

patent vortex
#

i found it in a few minutes

viscid grove
#

Does anyone know how to access the list of favorited channels from the experiment dev://experiment/2026-01-favorites-server

#

discord is enshitifying it to only be available to nitro, and now i can't see which channels i had favorited

viscid grove
#

(i did find a screenshot i took, so it's not that important anymore, but would still be curious if anyone does know)

torpid solar
jade stone
valid jetty
#

yes please

jade stone
#

soon

deep mulch
#

send to me @jade stone

jade stone
#

do you want it?

#

@valid jetty where can i upload a 6gb archive

valid jetty
frosty obsidian
#

oh is that the bigger leak

torpid solar
jade stone
#

i downloaded a ps3 one and the bigger one

#

this is both

frosty obsidian
torpid solar
#

o

#

im gonna try to get my friends to hop on if online works (i doubt it does)

lucid trail
#

no limit on storage, 10gb max file size

deep mulch
jade stone
#

Have to make acc

deep mulch
#

4chan insane@jade stone

#

pocket edition leaked too

#

I found download

fierce pendant
#

express running on chakra is the slowest js http solution

winged mantle
fierce pendant
#

ts pmo

#

this isnt related to this channel at all

winged mantle
#

nice you're a geometry dash player

fierce pendant
supple whale
#

@jade stone hop over to matrix fr fr

shrewd canopy
supple whale
#

i doubt it has much life in it left

potent hornet
#

Would it be possible to have either a plugin or feature for vencord that basically joins steam into it? like allows you to launch games and/or show your library from steam into discord?

ornate quiver
#

isn't this really easy

#
window.open("steam://rungameid/730")
#

yeah look it works

#

pointless though

winged mantle
#

gpui tricked me into enjoying tailwind

supple whale
#

that isnt tailwind wtf XD

winged mantle
#

pretty sure it's tailwind inspired

supple whale
winged mantle
#

zed talks about it on their blog

supple whale
#

this is just generic atomic css classes

#

in some sort of functional cursed lang

#

tailwind isnt that

#

tailwind is about generating classes/css based on your code

#

and providing the intellisense and utilities for generating them

winged mantle
#

anyway probably an observation I've made before but the average rust gui lib that people might call "native" actually feels less native than electron

supple whale
#

XD

#

mood af.

winged mantle
#

I think different people mean different things because there's both native in the sense of native unsandboxed code and native as in actually fitting into the platform

supple whale
#

when people say native, they often mean "doesnt have that feeling of generic web UI"

#

and sometines "includes platform provided components with their animations and stylings"

winged mantle
#

😭

supple whale
#

like androids materialUI/materialYOU, buttons with their transitions and animations

#

tho for the most part, these things can be done with 10 lines of css

#

i wanted to write a paper on "what makes UI feel like webUI"

#

and it mostly boils down to the few lines of default CSS browsers provide, and how click actions and events are done and handled

royal nymph
supple whale
#

I'd say that

img,a {
  -webkit-user-drag: none;
}

*:focus-visible {
  outline: none;
  border-image: fill 0 linear-gradient(#8885, #8885);
}

*::-webkit-scrollbar {
  display: none;
}

a[href],button,fieldset,input,optgroup,option,select,textarea,details,[tabindex],[contenteditable] {
  &:active:not([disabled], [type='range'], .no-scale, [tabindex="-1"]) {
    transition: all 0.1s ease-in-out;
    transform: scale(0.98);
  }
}

.scale-parent:has(.no-scale:active) {
  transition: all 0.1s ease-in-out;
  transform: scale(0.98);
}

is enough to make most web UI's not feel like web UI's, well at least 30% of the way there

winged mantle
supple whale
#

then add some 10 LOC for a view transition, and people will be hard pressed for telling that something is a webui lol

winged mantle
#

using rust for a project because it seemed to have promising gui options but idk there's probably more quantity than quality rn

supple whale
#

unironically

#

just make a "chrome only framework"

#

like after all the bullshit i put up with

#

i arrived at "yup, just make it all chrome/electron only"

winged mantle
#

I'm not really interested in making electron stuff

#

but I can understand why people are

supple whale
#

simply nothing comes even remotely close

#

oh no, its not that i love electron

#

its good, sure

#

its just everything else is dogshit

fierce pendant
#

we should embed chrome in webassembly to fix browser incompitability

supple whale
#

like NOTHING else comes close to chromium's performance, and HTML/css's ease of use for making UI

supple whale
#

:))))

#

firefox never stop loosing

fierce pendant
#

rewrite chrome in js to fix browser incomoitability?

supple whale
supple whale
#

we love firefox!

fierce pendant
#

i use firefox and its okay

winged mantle
#

not even ai slop made me switch away from firefox

supple whale
#

yeah because u dont write code for it

#

developers simply neuter their software to make sure it runs on ff

#

so TLDR you get worse or slower software, on all browers, just because ff exists

winged mantle
#

i use firefox basically because I like the ui better

#

rewrite firefox as chromium fork

supple whale
#

i dont care about UI enough

#

i care about my browser not imploding, and being able to replace my native apps with modern APIs

#

WebHID for device driver updates my beloved

#

fuck having to install razer synapse

fierce pendant
#

i just found out my god has claude code aliased to cc

jade stone
#

No good UI options in rust

winged mantle
#

the dx is pretty nice with some of them though

jade stone
#

which ones wires

supple whale
winged mantle
#

gpui with gpui-component

supple whale
#

because after using czkawka, the rust file system managment is so fucking fast its nuts

#

but the UI is so ass

jade stone
#

Ah I never got to try out gpui

supple whale
#

and files looks so nice, but is so ass

winged mantle
#

I used rust because I would use go but ui in go is probably worse

jade stone
#

Tauri has experimental cef support so I think I will try that out next

winged mantle
#

except using qt from go might be better

#

the qt rust wrapper i found needed unsafe everywhere 😭

#

I mean you should be able to have good ux with gpui

#

I've heard accessibility is nonexistent

supple whale
#

i want to build my own UI framework for android using TWA's

#

which would make it 1:1 electron-like at that point

#

since i wouldnt need to use webviews with TWAs

#

but google's own examples for TWAs dont work

winged mantle
#

a glaring issue with gpui for me is the extremely blurry text but for some reason it's fine in my app

supple whale
#

ah, sub-pixel rendering

fierce pendant
#

i love drinking tea and progaming

winged mantle
#

not everything is about subpixel rendering, sometimes the pixels seem to just not be aligned right

supple whale
winged mantle
#

ah it seems to be especially bad in pandora launcher which uses a particular font

winged mantle
supple whale
#

no, because of pixel interpolation

#

its fucking ass

#

buy a QDOLED, then spend 2 months researching why fonts look shit on it

#

and you'll learn

winged mantle
#

lol this is zed's hamburger menu

supple whale
#

harfbuzz is pretty much the go-to for font rasterizers, but its infexibility in custom subpixel layouts is annoying

supple whale
#

yesn't

fierce pendant
#

"every poopoo time is a peepee time but not every peepee time is a poopoo time" - sun tzu

dense sand
#

they are thanking their own fucking bot in blog sobvelasmutny

fierce pendant
dense sand
#

hmm okay

supple whale
#

:bunslop:

fierce pendant
dense sand
placid cape
winged mantle
#

this is why you don't let your users set the font

fierce pendant
deep mulch
jade stone
winged mantle
#

actually the font is called D050000L

deep mulch
fierce pendant
winged mantle
#

I wanna like rust but spending hours trying to get a small amount of code to compile feels like it takes the fun of programming out for me and makes me feel demotivated :(

#

when I do get something to work it feels great but I feel like I am still yet to be remotely productive

#

today I saw 84 compiler diagnostics on the same line (hint: async was involved)

median root
#

for me its just the size of the debug packages that get built bro 😭

#

300 megs for a simple project

winged mantle
#

hmm maybe if gpui has its own thread pool i don't need tokio

#

hmm but that might be wasteful

#

tokio can make more efficient use of threads right? so it doesn't need a whole thread per ongoing request? 😭

#

seems aio and select can be used

#

nvm aio isn't that popular

austere idol
#

how to read from multiple named pipes at the same time in python
i guess spawning an Process for every fifo is not a good idea

winged mantle
#

with rust analyser there were like 80 errors on the same line

glass skiff
winged mantle
#

cargo build also vomits out a lot of output in these cases though

#

i close the terminal and reopen it just for a clean slate

#

the problem is functions like tokio::task::spawn and methods like this background_spawn one require the future/closure to have a static lifetime which means they can't capture anything that isn't guaranteed to be valid for all eternity

#

I guess that's valid since the thread could outlive any of the references you are trying to use

#

it seems most people put Arcs on things but surely there's a better way...

#

I mean why use rust just to use a mini gc anyway

glass skiff
#

why not move the owned data in and get the results back from a channel or something like that?

winged mantle
#

I am spawing a task from the UI thread which I can't just await/select on a channel on

glass skiff
#

then you should probably use cx.spawn instead of cx.background_spawn to tie it to the lifetime of the ViewContext instead.. IF the task is local

winged mantle
#

pretty sure spawn is for sending a task back to the UI thread

glass skiff
#

wait lemme check again

winged mantle
#

if i do this in the main function

        println!("main {}", std::thread::current().name().unwrap_or_else(|| "unnamed"));
        cx.spawn(async |_| {
            println!("spawned {}", std::thread::current().name().unwrap_or_else(|| "unnamed"));
        }).detach();

it prints

main main
spawned main
#

background_spawn on the other hand I have observed to execute on threads named worker-...

glass skiff
#

but that task doesn't actually .await anything, with rust's async the task starts on the current thread and only moves (or lets the thread do whatever else) when it actually hits an await point.
i think the reason you see worker-... is because background_spawn is explicitly pushed to the thread pool immediately.

#

in cx.spawn i think if the executer sees the task is tiny and doesn't .await it just runs on the main thread

winged mantle
#

this is how I saw the thread name btw blobcatcozy

thread 'Worker-0' (21855) panicked at /home/me/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hyper-util-0.1.20/src/client/legacy/connect/dns.rs:119:24:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
winged mantle
glass skiff
winged mantle
#

idk.. rust async is very new to me

winged mantle
#

ohh wait I guess the tokio runtime would move it to another thread