#๐Ÿช…-progaming

1 messages ยท Page 10 of 1

dusty moth
#

i:int=5

winged mantle
#

the space between int and i makes a difference

brave gyro
#

Ye cuz there might br a type called inti

#

It doesn't know

dusty moth
#

you kinda need to have a token splitter

glacial mirage
#

/run

fn main(){let i=5;println!("{i}")}
rugged berryBOT
#

Here is your rust(1.68.2) output @glacial mirage

5
winged mantle
#

imagine if you can have equalks in variable

#

int i=5 = 5;

dusty moth
#

type-dependent parsing is a good way to have everyone stab you

glacial mirage
#

rust is almost there but the let needs a space

dusty moth
winged mantle
#

:3

glacial mirage
#

what awful things

#

oh no type inferrance !! scary

winged mantle
#

make me use github search to work out what a function does then jump between several sites for documentation

#

worst case

glacial mirage
#

you love

SomeReallyLongClassNameYouHaveToWriteTwiceAbstractFactoryGenerator x = new SomeReallyLongClassNameYouHaveToWriteTwiceAbstractFactoryGenerator(5);
winged mantle
#

but i prefer writing auto explicitly

#

idk it just feels nicer to me

dusty moth
winged mantle
#

what language is this

dusty moth
#

(```rs for highlighting only)

dusty moth
#

not yet complete; still have some bugs to iron out

winged mantle
#

why no semicolons

#

but therei s on the first line

dusty moth
#

shit that's a Rust variable declaration

#

ok now it's fir

winged mantle
brave gyro
#

Are the things after foo the typenames?

dusty moth
#

yeah

glacial mirage
#

imo dreamberd solves this problem

const var i: Int = 5?
brave gyro
#

Why do you need to specify type names when you're calling the function?

winged mantle
#

where draeberd compiler

dusty moth
winged mantle
#

i folloewd the dreamberd github rpeository before people were even youtubing about it

#

still not compielr

brave gyro
#

Imma look up what that is ๐Ÿ˜ญ๐Ÿ˜ญ

dusty moth
#

the a: T pattern/expression/type returns a and requires it to be type T

brave gyro
#

Oh I think in c & c++ thats called casting

glacial mirage
#

how does it achieve that

#

are there explicit functions like rust's From trait

dusty moth
brave gyro
#

Unless it's some sort of overload stuff that converts the variable via a weird function

winged mantle
#

it assumes it

dusty moth
#

therefore foo has the type for(n: type) n if Integral(n)

winged mantle
#

in c++ dynamic_cast uses rtti i think

#

(runtime type info)

dusty moth
#
trait Integral(n: type) {
  fn fromInteger(x: Integer) โ†’ x
  fn toInteger(self: n) โ†’ Integer
}```
brave gyro
#

Well not from

#

Idk

dusty moth
#

haha template<typename T> operator T&

winged mantle
#

but not the other way round

#

is #"
multiline string
"""#
cursed

#

huh

brave gyro
winged mantle
#

in c there's only (typename) var afaik

brave gyro
#

The 5th cast for c++ is just c casting

#

Oops I'm dumb

#

I wrote it the wrong way

winged mantle
#

int(0.0) works in c++

#

but not c

brave gyro
#

Really?

#

I've never tried that before

winged mantle
#

it introduces ClassName var(5) so they thought it would only be right to introduce int var(5) too i guess

brave gyro
#

Yeah because that's the same thing sort of

winged mantle
#

i guess it's like there's explicit int(float) somewhere lol

brave gyro
#

In assembly, there is no actual difference to int i = 5 vs int i(5)

#

At least what I've observed

dusty moth
#

i = mut(t = int)(5) trolley

brave gyro
winged mantle
#

constructor

#

but it's part of the language itself

brave gyro
#

Int doesn't have a constructor

winged mantle
#

it basically does

brave gyro
#

Its just an int

#

The data gets copied into the stack and that's it

winged mantle
#

i mean the language abstracts that all away

brave gyro
#

True

winged mantle
#

you can do int()

#

or at least int{}

#

maybe not int()

#

/run

#include <iostream>

std::cout << int() << '\n';
rugged berryBOT
#

Here is your c++(10.2.0) output @winged mantle

0
winged mantle
#

ok that does work

brave gyro
#

/run

std::cout << "e";
rugged berryBOT
#

@brave gyro I received cpp(10.2.0) compile errors

file0.code.cpp: In function 'int main()':
file0.code.cpp:2:6: error: 'cout' is not a member of 'std'
    2 | std::cout << "e";
      |      ^~~~
file0.code.cpp:1:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | int main() {
chmod: cannot access 'a.out': No such file or directory
/piston/packages/gcc/10.2.0/run: line 6: ./a.out: No such file or directory
brave gyro
#

Why does it not require main but it requires iostream lol

winged mantle
#

you can't do this

#

/run

#include <iostream>

struct Structure {
   int age;
};

int main() {
    Structure structure(26);
    std::cout << structure.age << '\n';
}
rugged berryBOT
#

@winged mantle I received c++(10.2.0) compile errors

file0.code.cpp: In function 'int main()':
file0.code.cpp:8:27: error: no matching function for call to 'Structure::Structure(int)'
    8 |     Structure structure(26);
      |                           ^
file0.code.cpp:3:8: note: candidate: 'Structure::Structure()'
    3 | struct Structure {
      |        ^~~~~~~~~
file0.code.cpp:3:8: note:   candidate expects 0 arguments, 1 provided
file0.code.cpp:3:8: note: candidate: 'constexpr Structure::Structure(const Structure&)'
file0.code.cpp:3:8: note:   no known conversion for argument 1 from 'int' to 'const Structure&'
file0.code.cpp:3:8: note: candidate: 'constexpr Structure::Structure(Structure&&)'
file0.code.cpp:3:8: note:   no known conversion for argument 1 from 'int' to 'Structure&&'
chmod: cannot access 'a.out': No such file or directory
/piston/packages/gcc/10.2.0/run: line 6: ./a.out: No such file or directory
winged mantle
#

but you can do this

#

/run
/run

#include <iostream>

struct Structure {
   int age;
};

int main() {
    Structure structure{26};
    std::cout << structure.age << '\n';
}
rugged berryBOT
#

Here is your c++(10.2.0) output @winged mantle

26
brave gyro
#

Yeah but if the cpp team added your struct to the overloads of cout, it could

winged mantle
#

it's getting age

brave gyro
#

Too bad c++ doesn't have introspection

brave gyro
winged mantle
#

that doesn't work

brave gyro
#

It overloads the bitshift left operator

winged mantle
#

this does

#

spot the difference :3

brave gyro
#

Lmao

#

I don't feel like retyping what I was gonna say......

winged mantle
#

press ctrl+z?

brave gyro
#

I'm on phone

winged mantle
#

ah

brave gyro
#

My point was that technically cout could print your struct if they overloaded it and internally printed the int

#

That's it

#

(Overloaded it) => Overloaded bitshift left operator with your struct

surreal condor
#

iirc you can like overload operator<< for structure or something like that

winged mantle
#

i think javascript strings length being wrong makes total sense now

#

they're encoded in utf-16, right? so length gives you the number of bytes / 2

cerulean plover
#

what the fuck?

#

utf16 can die

#

worst encoding blobcatcozy

winged mantle
#

so it will be wrong for characters which don't fit into utf16

#

like emojis

cerulean plover
#

okay that makes sense

dusty moth
cerulean plover
#

but you should not be using string length as length in bytes for any reason

dusty moth
#

the {} does memcpy initialization so it's fine

winged mantle
#

huh

#

why is memcpy involved?

winged mantle
#

java actually handles this worse

dusty moth
winged mantle
#

length returns the wrong thing, looping over it gives you multiple characters for ๐Ÿ™‚ too

cerulean plover
winged mantle
#

(and it is actually one unicode character)

cerulean plover
#

because java is utf16 natively

dusty moth
#

hmm that reminds me, I need to handle strings

cerulean plover
#

vchars ๐Ÿ™‚

elder yarrowBOT
cerulean plover
#

husk

winged mantle
#

this does [...string]

cerulean plover
#

not useful

winged mantle
#

which makes it loop

#

/run

console.log("๐Ÿ™‚".length)
rugged berryBOT
#

Here is your js(18.15.0) output @winged mantle

2
brave gyro
#

Sussy encodings making life harder

dusty moth
#

vchars ๐Ÿ‡บ๐Ÿ‡ธ

elder yarrowBOT
winged mantle
#

length is just reading a value

dusty moth
#

/run ```js
console.log("๐Ÿ˜„".length, [..."๐Ÿ˜„"].length)

winged mantle
#

iterator must do additional decoding

rugged berryBOT
#

Here is your js(18.15.0) output @dusty moth

2 1
dusty moth
#

why is โ˜บ 1 codepoint but ๐Ÿ˜„ is two

#

the fuck

winged mantle
#

โ˜บ is one

#

โ˜บ๏ธ is two

#

oh wait

#

maybe not

#

discord handles this weirdl

#

maybe there's some kind of control character

#

it uses โ˜บ and variation selector

dusty moth
#

โ˜บ is just my keyboard's Compose :)

winged mantle
#

which makes destructure the same length

#

as it's not a surrogate pair but rather two different charws

autumn sigil
#

emoji are so fucked

dusty moth
#

emoji โ†’ ๐Ÿ—‘๏ธ :fire:

winged mantle
#

yeah tbh i was amazed you could make something to count them in under 100 lines of javascript

dusty moth
#

I'll probably make iteration (and length) give graphemes in fir

winged mantle
#

characters like time are something where i won't bother to write it myself

brave gyro
dusty moth
#

unicode is black fucking magic

brave gyro
#

Proof I still have much to learn

winged mantle
#

with time you might end up writing time travel code by mistake

#

one thing i never use libraries for is getting a random value from an array

dusty moth
#
#

There are 47 other projects in the npm registry using is-even.
husk husk husk husk husk husk husk husk

winged mantle
#

i think if you're using this the way you write code is wrong

#

well idk

#

either it's wrong or it's just javascript

dusty moth
#

JS is just Like That\โ„ข

winged mantle
#

type safety is nice

#

typescript is nice

#

even if it's a bit cursed

brave gyro
#

Does the % operator work on floats in JS?

dusty moth
#

{} + [] evaulates differently in devtools and node repl

dusty moth
winged mantle
#

i like typescript because you can write smoething somewhat typesafe (*cough *any) in a reasonable amount of time

dusty moth
#

typescript has dependent typing right?

winged mantle
#

is there typebython

brave gyro
dusty moth
winged mantle
dusty moth
#

there are no ints

brave gyro
#

Really?

dusty moth
#

only doubles and integers

winged mantle
#

is there myby

dusty moth
#

making fir have optional braces now

#

(as in they'll just be fucking ignored)

winged mantle
#

is fir meant to be similar to dreamberd

dusty moth
#

what's dreamberd

winged mantle
#

it has const const

dusty moth
#

oh that's the uhh const const const a = 2 thing

#

in Fir all variables are const

#

the mut function creates a const pointer to mutable memory

#

e.g. a = do mut(2), then a.put(3)

autumn sigil
#

if only it had more support

dusty moth
#

(the do is important as it wouldn't know it's supposed to do something; without it it'd set a to the action of making mutable memory)

dusty moth
autumn sigil
#

cant even json that shi

winged mantle
autumn sigil
#

but also

winged mantle
#

doesn't json technically support 64 bit integers

#

even 128 bit integer

autumn sigil
#

ig you could make ints with uint8arrays?

#

/16/32

dusty moth
#

why only have i(32) and i(64)? I'm going to fuck with i(37)

dusty moth
winged mantle
#

what's the point of floating point numbers tbh

autumn sigil
#

ohhhh

winged mantle
#

1500

autumn sigil
#

that sucks wtf

winged mantle
#

they are a useful abstraction lol

dusty moth
# autumn sigil ? wdym

coerce index to uvar โ†’ index array โ†’ coerce to number โ†’ add 1 โ†’ coerce to u(8) โ†’ store into array

winged mantle
#

they're so evil

autumn sigil
#

i love javascript javascript is so awesome

dusty moth
#

what's 0.1 + 0.2

autumn sigil
#

not == 0.3

winged mantle
#

do you want the right answer or the ieee answer

autumn sigil
#

but thats just ieee

brave gyro
#

Obviously 0.30000001

dusty moth
#

as a tribute to 0.1 + 0.2 I'm introducing floating-point error to my ints

#

now 1 + 2 == 34

winged mantle
#

the nes's cpu had no floating point support

dusty moth
#

they used fixed-point

#

nowadays we use broken-point

brave gyro
#

Are floating point errors caused by inaccuracies in converting from base 10 to base 2 and back?

dusty moth
#

yes

brave gyro
#

K

dusty moth
#

like how โ…“ is representable easily in base 3, but not in base 10

brave gyro
#

God floats are just weird

winged mantle
brave gyro
#

Yeah but I think both the mantissa and exponent are stored in base 2.... because bits.....

#

Those stinky bits

winged mantle
#

i have never bothered to learn ieee 754

#

just reinterpret cast and hope every platform uses it

brave gyro
#

Damn lol

#

I only know 32 bit floats

dusty moth
#

isn't reinterpeting a float as an int explicitly UB?

brave gyro
#

Doubles I haven't looked at at all

winged mantle
#

i'm just gonna say implementation defined to make myself feel a little better

dusty moth
#

then again all code I write can trigger UB

winged mantle
#

i think ub is stuff you should never do

#

but assuming ieee is okay... as long as you check in the built setup that it's supported ig

dusty moth
#

nah i'd *argv

winged mantle
#

that always works lol

#

*argv is the program name

dusty moth
winged mantle
#

argc

#

argv meet argc

dusty moth
brave gyro
winged mantle
#

its the user's fault for not reading the docs

dusty moth
brave gyro
#

Ah

winged mantle
#

i will troll them with a segmentation fault or memory corruption

dusty moth
#

SIGSEGV? time to rm -rf /*

median root
#

are there any plugins which use ApplicationCommandOptionType.ATTACHMENT?

stoic helm
#

the ctrl+shift+f in question

median root
#

๐Ÿ˜ฎ

#

i never knew that existed

#

thanks

winged mantle
#

lol me neither

#

i always opened a terminal and used grep

quick crow
#

I knew it exsited but never used it

#

Mainly because i dont open the vencord folder

median root
#

tbf its prolly something to do with my vs settings (which i cant be bothered to fix) but i always get spammed with plugin errors from the custom dependencies when i open an editor but its fine when its opened alone

winged mantle
#

here's a fun question.
what can you supply to the arguments of this program to make it crash blobcatcozy

if (process.argv < 3) return;
console.log(`${JSON.parse(process.argv[2])}`)
#

oh wait

#

obvs just invalid json

#
if (process.argv < 3) return;
try {
    console.log(`${JSON.parse(process.argv[2])}`)
} catch (error) {
   if (!(error instanceof SyntaxError))
       throw error;
}
#

i just found out this is crashable

#

or even this

if (process.argv < 3) return;
try {
    var myCoolObject = JSON.parse(process.argv[2]);
} catch {
}
console.log(`My cool object: ${myCoolObject}`);
#

makes it more obvious

#

but it's also scary i never thought of this

#

everything is a lie

winged mantle
#

okay i'll just share because it would be useful if anyone could tell me how to prevent this

#

(google will not help)

stoic helm
#

scary

winged mantle
#

encodings are painful

#

it suddenly occured to me that my whole life i have been telling languages to parse something with utf-8 but that might cause bugs...

#

what if something wasn't saved with utf-8

stoic helm
#

user error

#

kill them

winged mantle
#

LOL

#

isn't the default on windows something else

stoic helm
#

idk

#

in notepad

winged mantle
#

then you'll get an error with any input

cerulean plover
#

wait

#

is it?

buoyant trellis
brave gyro
#

beautiful code

royal nymph
#
const isMalware = object => ["toString", "valueOf", "__proto__"].some(k => Object.hasOwn(object, k))
#

idk if there are any other silly keys

winged mantle
#

or just object.proto = null so it always fails

#

is accessing __proto__ UB

royal nymph
#

it's non standard you shouldn't really do it

#

but in reality it's standard

#

you should use Object.getPrototypeOf and Object.setPrototypeOf

winged mantle
#

you love document.all

dusty moth
winged mantle
#

how to test if document.all is actually supported

#

!!document.all?.toString

#

or even (document.all ?? 0) !== 0

autumn sigil
dusty moth
#

sad ๐Ÿ˜ข

dusty moth
ivory heath
#

all of this code honestly gives nearly no benifit to what im trying to acomplish it just makes what im doing "feature complete"

autumn sigil
dusty moth
#

what language

ivory heath
#

golang

jade stone
#

is there a good guide somewhere on how to write systemd unit files

#

i have no clue, and havent found any good docs

severe zealot
#

i just look them up online

jade stone
#

huh

#

where did you find docs

severe zealot
#

no docs just community made ones

hushed pebble
#

it's not necessarily as fast as one might desire

#

unless you love python

autumn sigil
#

oops my bad

#

didnt mean to caps

#

i know, ive been using js for years now

hushed pebble
#

then you know number is just fine :3

autumn sigil
#

i dont

#

i would use bigint for ints all the time.

#

but at no point do i ever need an int unless im indexing an array

median root
#

Any reason?

full seal
royal nymph
#

is it just me who hates how ugly typing destructures is in typescript?

function foo({ bar }: { bar: string; }) {}
#

i wish there was some syntax like this:

function foo({ bar: string; }) {}

i know this clashes with renames, but HuTaoShrug

#

it's especially ugly in react component that take like 10 props

analog hearth
#

I usually just do this ```ts
interface Props {
a: string;
b: string;
}

function Foo({
a,
b
}: Props) {}

or ```ts
function Foo({
  a,
  b
}: {
  a: string;
  b: string;
}) {}
ionic lake
#

you should just make a props interface but yeah

analog hearth
#

if I have wayy too many props tbh I just don't deconstruct it anymore

dusty moth
#

that shouldn't conflict with pure js; might make a PR if I randomly remember this

royal nymph
#

pr to what? typescript?

#

doubt they'd accept that

analog hearth
#

yeah don't think

winged mantle
#

you probably need to make an rfc and sent it in a letter to typescript hq

autumn sigil
#

youre not casting

royal nymph
fallow jasper
#

no way duke

#

did you know that duke has its own comic?

autumn sigil
#

i beg of you.

#

not duke.

frigid summit
#

helo

#

If anybody has any good ideas for it, I'm making a distro tailored for creatives and would like some input on desires and what would help to seperate my distro from the crowd

frozen pendant
#

Honestly not sure where to begin. Is there any way i can 'intercept' messages being sent from the message bar?

#

as in, get the event before the discord client would?

royal nymph
#

once again xy problem :p

frozen pendant
#

I don't think so in this case; I'm trying to pass it up into the main app so that I can redirect it to another account

#

my current 'project' is like pluralkit but w/ real accounts instead of bot

#

if a user types a message that's supposed to be redirected elsewhere it'd be a bad idea to let discord process it

royal nymph
#

if u use vencord it's easy

frozen pendant
#

I wish it would actually load here ;w;

#

nomatter how early i specify the preload it never seems to load properly

#

i've found the react code responsible but i have no idea how to hook it

#

actually, figured out it's much easier to just hook the sendMessage function instead of trying to hook the message bar directly

royal nymph
frozen pendant
#

egh. Even with a completely unmodified web client anti spam seems to absolutely hate me and my client

#

I'm almost always getting captchaed or forced to reverify

frozen pendant
#

yeah

royal nymph
#

you need to spoof user agent

frozen pendant
#

i do

royal nymph
#

to what

frozen pendant
#

chrome 126

royal nymph
#

send UA

frozen pendant
#

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.3

royal nymph
#

are you actually on Windows?

frozen pendant
#

yes

royal nymph
#

and what does navigator.userAgentData.brands[1].version say

royal nymph
frozen pendant
#

ah. that resolves 118

#

Yeah i thought it was weird too but thats what i originally observwd from chrome 126

#

might just be my mistske though

#

Do i need to spoof yhe userAgentData too?

frozen pendant
#

Oh vesktop just uses a ua per platform and that's it?

#

no need to poke with userAgentData?

royal nymph
#

nope

#

just UA

#

has to match platform correctly and be right chrome version

frozen pendant
#

ah okay

frozen pendant
#

Curious, does vesktop fix screen share support?

#

atleast for me any calls to getMediaEngine().getDesktopSources() would result in DOMException: Not supported

#

stupid question I could have just searched the repo, lmao

ivory heath
#

POV you use golang

frozen pendant
#

this error still perplexes me. It's literally the first thing in the preload

serene elk
#

is that in the browser?

frozen pendant
#

No, it's a webPreferences.preload on a <webview> in electron 31

serene elk
#

here's your answer

#

you are not supposed to run vencord with webPreferences.preload

frozen pendant
#

Yes; i have contextIsolation disabled for this testing

serene elk
#

you need to attach Object.defineProperty(window, "Vencord", { get: () => Vencord }); to the end of the preload

#

or just use webframe.executeJavaScript

frozen pendant
#

well, it's a start xD

#

no vencord menu but it has the version string

#

NEVERMIND i'm just blind

royal nymph
#

that also means you can use vencord apis now

#
#

(alternatively you could access via raw global but it's not recommended)

autumn sigil
jade stone
#

why does hardcoded regex vs regex in a variable change the output with String.matchAll

#

this gave me a headache for too long

stoic helm
#

???

#

show code

jade stone
#

i use this regex a lot, so i defined it at the top of my file

#

const emojiRegex = /<(a?:\w+):(\d+)>/g;

#

i have these lines in a function to test my regex beacuse it wasnt working

    console.log("text", text);
    console.log("matches", [...text.matchAll(emojiRegex)]);
#

it outputs

text "asd ![blobcatcozy](https://cdn.discordapp.com/emojis/1213739137941639168.webp?size=128 "blobcatcozy")  to21lkasdj ![trolley](https://cdn.discordapp.com/emojis/1188175804325175339.webp?size=128 "trolley")
matches [
    [
        "![trolley](https://cdn.discordapp.com/emojis/1188175804325175339.webp?size=128 "trolley")",
        ":trolley",
        "1188175804325175339"
    ]
]
#

but when i run this in the browser console

[...('"asd ![blobcatcozy](https://cdn.discordapp.com/emojis/1213739137941639168.webp?size=128 "blobcatcozy")  to21lkasdj ![trolley](https://cdn.discordapp.com/emojis/1188175804325175339.webp?size=128 "trolley")'.matchAll(/<(a?:\w+):(\d+)>/g))]

i get

[
    [
        "![blobcatcozy](https://cdn.discordapp.com/emojis/1213739137941639168.webp?size=128 "blobcatcozy")",
        ":blobcatcozy",
        "1213739137941639168"
    ],
    [
        "![trolley](https://cdn.discordapp.com/emojis/1188175804325175339.webp?size=128 "trolley")",
        ":trolley",
        "1188175804325175339"
    ]
]
jade stone
#

If anyone knows why this is behaving the way it is, please let me know

autumn sigil
#

has to be user error trolley

#

works fine on my machine

atomic brook
#

Works fine even in termux

royal nymph
#

functions like .test() and .exec() change its state

atomic brook
#

Why does regex even need a state...

royal nymph
#

because you need it for looping

atomic brook
#

Can you give an example please

royal nymph
#
const re = /hi/g
const input = "hihihihihi";
let hiCount = 0;
while (re.test(input)) {
    hiCount++;
}
rustic turret
atomic brook
rustic turret
#

Bruh

royal nymph
#

if it's global you want to find all matches

rustic turret
#

does new RegExp take regex as an argument

royal nymph
#

so the regex keeps track of your position in the string

rustic turret
royal nymph
#

you can just reset the state

rustic turret
#

Oh, how

royal nymph
#

why

rustic turret
#

it's js being good

royal nymph
#

use global regex
complain that it finds all matches in string

rustic turret
#

it's being useful

rustic turret
#

each time you run it it finds the next match

atomic brook
royal nymph
#
const re = /hi/g
const input = "hihihihihi";
const matches = [];
let match;
while (match = re.exec(input)) {
    matches.push(match);
}
atomic brook
#

@jade stone does

rustic turret
#

ur missing out..,

royal nymph
#

this is how to find all matches in string

#

.matchAll is a very modern function that aims to replace that boilerplate

atomic brook
royal nymph
#

that's a user error

#

you're not supposed to

#

you have to reset the state

royal nymph
#

/run ```js
const re = /h/g;
console.log(re.test("h"))
console.log(re.lastIndex)
console.log(re.test("h"))
console.log(re.test("h"))

re.lastIndex = 0;
console.log(re.test("h"))
re.lastIndex = 0;
console.log(re.test("h"))
re.lastIndex = 0;
console.log(re.test("h"))

rugged berryBOT
#

Here is your js(18.15.0) output @royal nymph

true
1
false
true
true
true
true
rustic turret
#

Ah

#

Last index

#

I've used that before

atomic brook
rustic turret
atomic brook
#

Already did

winged mantle
royal nymph
#

they already fixed it

winged mantle
#

cool

#

unfortunately javascript has to keep compat so old cursed stuff is there forever

#

the main issue you create with globals in javascript is memory leaks but i guess it's just a counter?

royal nymph
#

they're instance properties not globals

#

wait til you find out about RegExp.$1 - RegExp.$9

#

/run ```js
/(c)d/.test("abcdefg");

console.log(
RegExp.input,
RegExp.$1,
RegExp.rightContext
)

rugged berryBOT
#

Here is your js(18.15.0) output @royal nymph

abcdefg c efg
royal nymph
#

funny global state

#

(deprecated ofc)

winged mantle
#

oh wait

#

HORROR

#

that's a memory leak even if regex is not global then?

#

why is it filled with so many nulls

#

nulls is bad for portability

#

i wonder what a c json parser does with \u0000

dusty moth
#

@atomic brook 5*

hushed pebble
analog hearth
#

@royal nymph do you know a more stupid way?

#

unsure if what I made even remotly makes sense if I start to think of it now

frozen pendant
frozen pendant
#

NVM okay that makes more sense, you were pointing me at a patch x3

royal nymph
frozen pendant
#

The patch wasn't enabled unless MessageEventsApi was also enabled, and wasn't in my case

broken shore
#

progaming

brave gyro
#

/run

#include <stdio.h>
int main() {
  printf("\033[0;31m");
  puts("red");
}
rugged berryBOT
#

Here is your c(10.2.0) output @brave gyro

red
void leaf
balmy lintel
#

no joke

#

open source

dusty moth
#

one backend dev runs the bot manually

#

netcat*

#

with tls powered by the Notebook library

still jolt
# dusty moth netcat*

*carrier pigeons โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹

main island
#

any of yall know how to deal with Java Mixins (minecraft modding specifically)

royal nymph
#

shrimply mix some shit in

#

๐Ÿ”ฅ

main island
#

ok wait- dont ask to ask just ask
is it possible to- cancel a constructor, or make it exit early?
trying to just mix into the constructor and use ci.cancel() gives an error

winged mantle
main island
#

they get easier

winged mantle
main island
#

fabric 1.21

#

for context the overall goal is to not addFeature() here

winged mantle
#

why not use @WrapWithCondition

#

then you can always return false

main island
#

will look into that

#

would be easier if it could find any sort of example on how to use it LMAO

#

WOO

viscid grove
#

I thought they were just based on their json model

main island
#

all mobs, kinda

#

they dont have json models

viscid grove
#

yes they do

main island
#

they dont

viscid grove
#

oh wait

main island
viscid grove
#

you need optifime for cem

#

or some other mod

#

they should add that to the game (cem)

main island
#

also yes it is now in the Drowned's classes because for some reason the drowned and only the drowned decided its sleeves shouldnt follow its arms

#

it forgot to register the fucking mixin thats why

dusty moth
main island
#

yeah dw kode gave a solution

jade stone
#

Vencord: v1.9.3 โ€ข 256a85c9 (Dev) - 7 Jul 2024
Client: stable ~ Vesktop v1.5.2
Platform: Linux x86_64
โš ๏ธ Vencord DevBuild
โš ๏ธ Has UserPlugins

royal nymph
#

the hell are these devtools bro

cerulean plover
royal nymph
#

okay tauri kinda fire

royal nymph
#

oh it doesn't quite work when packaged

#

need to fix

cerulean plover
#

i thought you were just gonna call a CLI to install it

#

and the installer GUI is just a wrapper

royal nymph
cerulean plover
royal nymph
#

the horror

#

some dude gonna have non unicode filenames and complain

#

oh i should use APPIMAGE not ARGV0

still jolt
stoic helm
#

rust in electron

#

handle all the logic in a native node module

final night
stoic helm
#

i know

#

i stay up to date in programming channels

final night
#

Why not gluon?

frosty obsidian
#

isn't gluon deprecated

final night
#

Oh

#

I haven't looked at it in awhile

royal nymph
#

please stop suggesting software you've never used before ๐Ÿ˜ญ

final night
#

Ok

winged mantle
#

when using optional(boolean(), true) in valibot for example, it's infered as boolean | undefined despite the fact that if it's not defined it will always just be set to true

winged mantle
#

nvm i might be doing something wrong

#

yeah i was using inferinput instead of inferoutput

brave gyro
#

std::shared_ptr is so cool

royal nymph
#

how the fuck do you check if there's a polkit agent running without a password prompt

#

pkcheck --process $$ --action-id org.freedesktop.packagekit.upgrade-system -u; echo $?

this works but it shows password prompt

royal nymph
#

okay nvm im dumb

#

pkexec --disable-internal-agent

jade stone
#

how did i never know pkexec was a thing

winged mantle
#

arghh, the challenge of creating an object which updates its state using an event listener and not creating a memory leak

royal nymph
#

personally the way i solved it is by just making a map

#
const handlers = new Map<string, Handler>();

eventEmitter.on("event", e => handlers.get(e.id)?.handle(e));
stoic helm
#

you cant have multiple handlers tho

royal nymph
#

well that assumes you have some id

stoic helm
#

ohhh

royal nymph
#

if you just want to call every handler always, you can use a Set instead of Map

#

technically you could even use a Map<string, WeakRef> / WeakSet and have js auto-gc the handler whenever there are no references left

#

but usually you have some clear destroy condition and you can just use that instead

final night
#

Discord try to use correct element challenge (impossible)
<span role="link">

#

why not just use an <a> and add a single preventDefault() to onClick

sharp basin
#

iโ€™d just have used a button

final night
#

browsers typically pre-fetch data for links on hover

#

but yeah a button would be a more sensible choice as well

sharp basin
#

iโ€™d have never noticed that pre fetch on hover behaviour on discord when I had dev tools open

#

though I never paid attention to that

royal nymph
#

cause it's a fetch

final night
#

you dont need custom preloader when browser implementation is enabled (it is by default)

I am pretty sure this is how browsers implement preloading into everything by default (pseudocode)

Link.Onhover = () =>{
  HTML = Fetch(link.href)
  Fetch(html.linkedShit) // <link>s and <img>s
  // unsure if following actually happens
  Run page js for limited time to fill dom (similar to how Google does before indexing) 
}
// all http responses are cached during this process, so site load is not slowed by web requests when user actually clicks link.

// notability this still improves loads where the link has event.preventDefault (assuming caches made in above are applicable to `fetch`es made by website's click handler)

@vending.machine#0000

#

@royal nymph ping broke somehow, see above

royal nymph
#
  1. im fairly certain hover preload isn't a stock feature, you have to do it with js
  2. even if it is, it definitely can't fetch arbitrary json api like discord requires
#

it's definitely manually if anything lol

sharp basin
#

frameworks like nextjs allow pre-fetch/have it by default

#

but discord doesnโ€™t, at least would never have noticed

#

and discord downloads all bundles on start iirc

royal nymph
#

no

frosty obsidian
#

i think discord just isn't structured in a way thats easy to prefetch

final night
#

I guess I saw a disclaimer for that elsewhere and assumed it applied to all links

#

I guess not

royal nymph
royal nymph
#

you have to put <link rel="prefetch" href="stuff" /> in ur head

final night
royal nymph
#

I am looking at exactly the section you linked

final night
royal nymph
#

when the user hovers their mouse over thumbnails on the New Tab page or the user starts to search in the Search Bar, or in the search field on the Home or the New Tab page.

#

has nothing to do with links

final night
#

Still more accessible and compatible to use an a instead of a button or span

royal nymph
#

how so

#

as long as you specify aria role (and apply link interactivity), it's equivalent in terms of accessibility

final night
#

Is role eqiv to aria-role? Because they don't have an aria-role

#

Did they remember to add back ctrl+click, middle click, and ctrl+enter to open in new tab?

  • If not, that is proof of compatibility point
  • If so, they had to put effort into doing that which is still a loss from not using the right element for the job
#

Going to sleep, ping me when you reply so I can read in the morning

royal nymph
winged mantle
#

but i would find it misleading that new ConfigCache("blahblah", blahblah_schema) creates a permanent reference

median root
#

is there another way to add reactions to messages yet or not

brave burrow
median root
#

๐Ÿ˜ฎ

#

thanks

autumn sigil
#

@frosty obsidian you use zed right? im trying to rebind some keys but i cant figure out how to do this

#

im basically trying to move all copilot autocompletion binds to shift tab
this is my current keymap

[
    {
        "context": "Editor",
        "shift-tab": null
    },
    {
        "context": "Editor && showing_completions",
        "bindings": {
            "enter": null,
            "tab": null,
            "shift-tab": "editor::ConfirmCompletion"
        }
    },
    {
        "context": "Editor && inline_completion && !showing_completions",
        "bindings": {
            "tab": null,
            "shift-tab": "editor:AcceptInlineCOmpletion"
        }
    }
]
#

the enter and tab keybinds dont work anymore which is good, but i cant get shift tab to do anything

autumn sigil
#

lmao

frosty obsidian
#

it doesn't like my gpu

royal nymph
#

its joever

autumn sigil
#

whats your gpu lol

#

i just had to install drivers

frosty obsidian
#

radeon r7 200 series

#

its old but should technically work

#

i think its just a bug

autumn sigil
#

bleh!

frosty obsidian
#

bc im not the only one with this problem

#

i think its a bug with amd gpus on windows

#

zed specific

autumn sigil
#

oh youre on windows? my bad xd

#

thought you were on linux because you were building yourself

frosty obsidian
#

luckily zed has officially finished linux support so hopefully they can focus on windows now

frosty obsidian
autumn sigil
frosty obsidian
#

well not technically since msys2 has a package but that didn't work

autumn sigil
#

hahaha i just noticed

frosty obsidian
#

hence why i built myself

autumn sigil
#

spelling error in config

#

but it still doesnt work.

frosty obsidian
#

try asking in the zed discord

autumn sigil
#

oh vsc just uses minus to remove keybinds

autumn sigil
#

lmao my dumbass forgot i wanted to actually bind it to shift enter and that works

brave burrow
#

Spotx does that

stoic helm
#

spotiven

brave burrow
#

Apparently they spotx-bash for linux/mac

royal nymph
#

it works for anything using webpack

#

maybe also other bundlers

sharp basin
#

@royal nymph how long did it take for the vencord chrome extension to get accepted initially?

quick crow
#

I've always wanted a spotify client mod with a similar patching/plugin system to vencord

#

Spicetify seems pretty weird

magic shale
#

does anyone know how to set up nginx on an oracle cloud vps cause i can not get it to work for the life of me

#

it seems no requests are actually reaching the vps and i have set up the security list properly

spark raft
#

Firewall/routing issue perhaps?

magic shale
#

iptables should be set up properly, i dont think there is really any other firewall

#

nvm i just had to reload firewall-cmd ๐Ÿ˜ญ

spark raft
#

The default policy for input chain is a bit weird; it accepts packets, so if none of the rules within matches, it should still go through ๐Ÿค”

#

Besides, iptables is becoming deprecated in favour of nftables. Oh well

magic shale
#

yay vps now has a sharex server

cerulean plover
elder yarrowBOT
frozen pendant
frozen pendant
#

neat!

patent verge
#

Where do i can ask questions related to plugin development?

patent verge
#

I dont have permissions to send Messages

jade stone
#

why does this regex have two matches

crimson cave
#

wdym

winged mantle
#

only 1

jade stone
#

no, like why does it have a second match from

#

typo with groups

crimson cave
#

the lookbehind

winged mantle
#

because * means 0 or more

jade stone
#

oh, im stupid

#

ty

crimson cave
#

yeah .* catches the asdasd

#

and the lookbehind is empty cause thats what its supposed to be

jade stone
#

changed it to .+ and hteres only one match blobcatcozy

crimson cave
#

oh

winged mantle
royal nymph
winged mantle
#

LOL

#

why did nobody ask

#

why would you match filename with regex

jade stone
winged mantle
#

name.substring(0, name.lastIndexOf(".")) โค๏ธ

jade stone
winged mantle
#

i hope it is! i probably should've checked

#

ye

magic shale
#

it is

sharp basin
weary plaza
sharp basin
#

because it is

weary plaza
jade stone
#

how does this even work

worldly sigil
frozen pendant
#

this would work for www.codeburger.com but the cert needs to have codeburger.com as CN or in SAN

jade stone
jade stone
frozen pendant
#

domains are weird

#

iirc sub-subdomains dont match *.example.com and *.*.example.com is illegal

jade stone
frozen pendant
#

dont quote me but no, only *.two.sadan.zip would

jade stone
#

thats crazy

jade stone
#

and i was too dumb to remove the www at the time

frozen pendant
frozen pendant
autumn sigil
atomic brook
#

How do I run this instead of nginx

autumn sigil
#

=w=

ionic lake
#

step one is switching your shit search engine to something else

thorny ingot
#

if i wanted a python script to be run every 49 minutes, how would i do that

autumn sigil
#

cron

thorny ingot
#

nope

thorny ingot
#

chron will not work???

#

literally

#

chron works in intervals

#

@trail brook its intervals of 5 right

trail brook
#

5 what

thorny ingot
#

minuted

#

like you can do 45

#

but not 49

trail brook
trail brook
#

yeah

#

that means

#

*/5 = every 5 minutes

#

*/x = every x minutes (per hour)

thorny ingot
#

i want every 49

frozen pendant
#

script.timer

[Timer]
OnUnitActiveSec=2940

thorny ingot
autumn sigil
thorny ingot
#

long story

#

41 minutes actually mb

royal nymph
#

that's what i do with a program

thorny ingot
#

vee i dont have systemd sobMeltdown

royal nymph
#
[Unit]
Description=Create Sponsor Graph

[Service]
Restart=always
RestartSec=3600s
ExecStart=node . -o /var/www/meow.vendicated.dev/sponsors.png
WorkingDirectory=%h/github-sponsor-graph
Environment="GITHUB_TOKEN=balls"

[Install]
WantedBy=default.targe
royal nymph
#

systemd so good

thorny ingot
#

or runit

royal nymph
formal belfry
#

how do i add sliders to context menus?

#

nvm

thorny ingot
royal nymph
#

idk bro

#

use systemd

#

hail lennard pรถttering

thorny ingot
#

wait

#

i think i can just use a sleep fucntion in a repeat loop in python

royal nymph
thorny ingot
#

and use a cronjob to start at boot

#

why

#

hows it worse than using systemd

royal nymph
#

less efficient

thorny ingot
#

gentoo systemd support is iffy iirc

jade stone
thorny ingot
#

no

spark raft
#

You're bound to be in the minority if you're using anything but systemd. Most popular distros (i.e. distros with generally the highest amounts of users) uses systemd by default. Less users for anything but systemd usually equates to less support, and less support has its own deficits

thorny ingot
#

openrc is the default, youd have to change your profile and configs to use systemd

#

Im not using nix.

dusty moth
thorny ingot
#

your point being

#

my point is i dunno how good the systemd init system on gentoo is

dusty moth
#

given the main entrypoint distros (mint, ubuntu, etc.) having large userbases and using systemd, systemd is much more common and therefore usually much more supported

thorny ingot
#

i could switch it out with openrc

thorny ingot
#

nothing to do with the convo

#

im talking about on MY system with MY os

#

not what most users use

dusty moth
#

you could write a C script or something

thorny ingot
#

ok but why?

dusty moth
#

then wrap that in a runit service

thorny ingot
dusty moth
dusty moth
thorny ingot
#

????

dusty moth
#

gentoo*

thorny ingot
#

openrc

#

is what i have rn

#

considering moving to runit

#

but my goal for rn is get it working under openrc

#

im considering just making a cronjob run a bash script at start-up that just loops every 41 minutes

#

its a python script so

#

shouldn't be that hard

#

and this computer will JUST be doing this

dusty moth
#

wait didn't linux have spawn at some point

dusty moth
#

my internet is crying

thorny ingot
#

well then why dont you catch it

#

wait

#

wrong joke

brave gyro
#

is there any way to do animation in js without using requestNextAnimationFrame or setTimout?

#

i know chrome doesn't update dom elements while the script is running but i'm just wondering if there are any hacks

magic shale
#

is there a reason you cant use requestNextAnimationFrame

brave gyro
#

i'm using wasm and i need to keep the script running

#

the real reason is very dumb

jade stone
#

in javascript, is there a better way to get all captured groups from regex other than matchAll()

royal nymph
lavish cloak
#

What do you guys think about Cisco certifications

sullen tapir
#

Not needed ig

#

but some places probably look at them

buoyant trellis
royal nymph
#

there shouldn't be any drift if u use cron

formal belfry
#

im struggling

#

i got 2 radio items and i want to make it only 1 at a time can be selected

crystal cedarBOT
#

Not enough messages saved for channel

ionic lake
#

if you show us your code then maybe we can help you

ionic lake
#

what's with that conditon in action

#

that also isn't enough code, ideally show the entire thing so understandably it's easier to look

#

I don't use react so I guess someone else will have to help you

formal belfry
#

could u [perchance vc so i can screenshgare

ionic lake
#

Nope, sorry ๐Ÿ™

formal belfry
#

react isnt the problem, its mainly the fact that it doesnt get udated after the conditon changes

#

liek in console everytime i click it it cahnges the boolean, but it never updates the button

royal nymph
#

you're not understanding how react works

formal belfry
#

oh

#

well, can u help? i just started yesterday

atomic brook
#

useState

formal belfry
#

gulp

royal nymph
#

you need to use react state

formal belfry
#

i did some stuff

#

bbut now another problem

#

when i select option 2 and leave the context menu, it resets back to opton 1

autumn sigil
#

it doesnt help when you only post jsx, please post the entire function if at all

royal nymph
#

e.g. in plugin settings

formal belfry
#

like it just breaks

formal belfry
#

bascially i wanna fix the radio buttons at line 117 128 155 and 165

#

wait that one crashes

royal nymph
#

and the error...?

formal belfry
#

so here

#

no error

#

its just

formal belfry
#

i dont know how/where to store the settings

solid gazelle
#

could I possibly make my own Store so I could have a shared state in 2 components added by 2 different regex patches?

royal nymph
#

yes

#

you can just extend Flux.Store

#

several plugins do

#

namely SpotifyControls and MemberCount

livid owl
#

Hi, how do I use modules like node-vibrant in a plugin?

stoic helm
#

just install it normally, and we reccomend if you only use it for one plugin then lazyload it (require it in the plugin start function instead of importing it normally)

#

but as a warning, plugins that add dependencies generally wont be accepted to upstream vencord, and they make it more complex to install as a third party plugin

livid owl
#

use the require function?

stoic helm
#
let nodeVibrant: typeof import("node-vibrant");

export default definePlugin({
    ...
    start() {
        nodeVibrant = require("node-vibrant")
    }
#

iirc thats how you should do it?

livid owl
steep vine
#

.

stoic helm
livid owl
livid owl
# stoic helm

for some reason i enabled it already but still dont have access to chat there

royal nymph
stoic helm
#

npm listing says it works in browser

#

bad naming ig

stoic helm
royal nymph
#

why do you need it

#

discord has a function for extracting colour from images

finite pond
#

@royal nymph Idk if you know it already but the Types for the Badge are wrong. It returns the UserProfile now

royal nymph
#

more than a month

finite pond
#

I use the Typespackage

royal nymph
#

that one is hardly ever updated

#

why do you use it

finite pond
#

3rd Party Plugins

royal nymph
#

just develop them inside ur vencord folder

finite pond
#

true lol

livid owl
sharp basin
#

Iโ€™d assume that there is one to get the accent colour of your pfp in case you donโ€™t have a banner

oak valley
#

You can set that manually but the default is based on profile picture afaik

sharp basin
#

did you find it

livid owl
winged mantle
#

there might be a better way to do this

#

typescript types are write only

autumn sigil
#

oh is that valibot

winged mantle
#

no it's my plguin framework

#

although i am using valibot for configuraiton

final night
#

wreq.f.css has the best code I have ever seen

else if (/^(5(0(04|331|565|779|866|872|929)|4(5(31|35|4|97)|310|343|642|845)|9(193|45|579|650|716|820)|3(9(00|26|37)|162|289|512)|8(059|120|175)|2(190|2|432|443|657)|7(359|486|539|650|884|951)|1([36]95|37|714|868|966)|5183|5642)|4(0(021|390|854|897)|5((13|26|3)0|125|36|423|621|863)|4(1(3|53|9)|400|442|798|808)|9(131|277|64)|3(135|350|761|973)|8(017|54|707|748)|2(278|360|66|758)|74(35|6)|1(128|17|281|292|814|916)|6(3(17|69|98)|051|161|514|826))|9(0(060|07|220|688)|5(172|226|257|58|8|883|925)|4(005|064|335|354|548|566)|9(8(09|38|57)|293|452|617)|3(288|54|671|776|932)|2(33[39]|173)|7(07|573|66|803)|1(134|249|553|605|729)|6(043|075|278|44|888|894)|8137)|3(5(282|401|489|641|73)|4(049|063|191)|9(092|143|511|627)|3(397|574|78)|8(062|266|310|413|795)|7(194|483|564|880)|1((|8)11|835)|6(371|869|970)|0364|2991)|8(0(305|4|404|797|991)|5(552|668|885)|4(248|686|725)|9(6(35|50|75)|069|289|900)|3(0(32|51|79)|264|536|660|942)|2(158|4|560|634|740|935|961)|7(200|337|353|450|549|786|931)|6(5(3|41|90)|060|465)|102|1553|8358|8938)|2(0(10[12]|212|26|45|55)|5(070|38|402|421|593)|4(273|35|642|783)|9(39[36]|608)|3(401|502|638|657|746|831|982)|8(382|479|538)|2((48|87|94)2|173|6)|7(157|751|877|919|933)|1(013|026|112|305|395|863|897|971)|6155|634)|7(0(192|669|675|742)|5(018|116|280|409|613)|4(194|543|590|673|920)|9([59]21|058|3|598|764)|3(02|628|685|751)|8(7(04|12|86)|273|333)|2(32(|3)|8(5|72|91)|135|458|920)|7((06|48|87)5|578|721)|1(0|517|700)|6(233|49|761|815))|1(0(667|831|926|941)|5(086|168|915)|4(021|466|604|653|760)|9(06|538|615)|8((1|6|91)2|(32|36|41)7|259|531|634|879)|2(192|633|736|876)|7(16|349|396|463|712|945)|6(083|130|169|31|359|547|633|77)|1166|1495|3111|3878)|6(0(493|623|74|827)|5(109|652|95|982)|4(9(08|41|5)|648)|9(015|208|417|473)|3(10|636|757|8|972)|8(614|720|784)|7(422|580|753)|1((36|52|53)6|297)|6([49]62|063|43|75|915)|2104|284))$/.test(t)) {
mellow phoenix
#

what the hell, you gotta post a warning before dropping shit code

final night
#

its discord code so it's ok

cerulean plover
potent cloud
#

what even is that checking for lmao??

cerulean plover
#

discord is smoking

stoic helm
#

looks like something webpack generated

#

an optimized regex for detecting module ids

cerulean plover
#

@royal nymph You will not be proud to hear my results so far in researching why that error occurs

pearl stagBOT