Programming

Macs should never lock up like that. You should try to exchange it if you can.

1 Like

For language, TypeScript if you need JS, otherwise Python if it can reasonably be done in Python, otherwise situational.

For algorithms, initially write it in a way that maximizes (in this order):

  1. Confidence that it produces correct results.
  2. Readability/clarity of expressing what’s going on.
  3. Speed of writing.

Once you’ve done that, you’re either done, or your code is too inefficient to meet requirements, which you can then fix via profiling and targeted optimizations.

1 Like

Can’t you just have everything compiled on save? Either using the IDE or tsc —watch.

Yeah this is called jsdoc and I use it on everything

1 Like

I’ve decided I’m finally going to try to learn Python so I can automate repetitive work tasks, Automate the Boring Stuff specifically says it just teaches you to cobble together something to perform basic automation so is there a good general beginning Python book anyone would recommend?

You can learn a lot from the Python docs:

RealPython is also a great source for deep dives on discrete features that you want to learn more about.

Peter Norvig has a good free online course:

Finally, Fluent Python is really good, although some of it is probably a bit heavy for a beginner.

1 Like

gsfdgsdhh this is really starting to annoy me.

I’m getting an arbitrary string (“content”) from a third party source and because of reasons I’m putting it in a Javascript object like this:

{ “url”: url, “content”: content }

Then calling JSON.stringify on it and passing it off somewhere else and calling JSON.parse, but when I do I get this:

Uncaught SyntaxError: Unexpected token in JSON at position 1306

I mean, it’s the one who created the damn JSON in the first place, now apparently I’m expected to deal with the fact that it’s poorly formed. The string has Chinese characters in it and so forth, I don’t want to have to care what’s in it, I want the language to deal with that.

How the hell are stringify and parse not transitive? Is there something built into the language that I can do to the string first to escape whatever this character is? I can’t get a straight answer to this googling it.

Is content a valid JavaScript string? Is the object valid before you stringify it?

You could use TextEncoder to get UTF8, then convert that to Base64, then reverse to decode.

It transpires that some script on the page is fucking with my string. The stringified object is added to a div which is appended to the body, again because of reasons, and some script native to the site I’m using my extension on is somehow messing with my string. Also wrapping it in two <font style="vertical-align: inherit;"> tags. I don’t even want to know why. I should be able to work around this.

Can you put it in a <pre> tag?

If I do that it will just do the same thing to the pre tag - i.e. insert font tags into it and mess around with the contents. It seems to have some hideous global MutationObserver or something that messes around with any element that gets added to the page.

Looks like the workaround is to append the element to the head instead, then whatever this script is won’t fuck with it. Chrome will allow me to append div elements to the head, which is not supposed to be allowed but whatever. Seems to work. If that ever gets outlawed I can switch to using meta elements.

Pre tags are supposed to be for raw formatted text, including line breaks, etc. That script might ignore what’s inside it.

How the NSO’s zero click exploit worked

1 Like

My thought is this is all bullshit unless they’re a core maintainer of a piece of open source tech we all know. I’ve more or less given up on stumbling into a 300k+ TC job and am happy enough with my comp at my midwest retailer who doesn’t make me work hard at all.

Yeah probably but I don’t think its worth it, maybe I’m wrong. I’m mid 40s college dropout with a decent house in the suburbs and wife who has a 100kish job and 2 old cats. I can’t see myself moving to san jose and going on interviews at uber really. But I don’t know what the next step is for me here that’s for sure.

What I really need to do is get off my ass and get my Latvian citizenship.

The company I’m at pays 25% less if you are remote / midwest. Still 300k+ is normal even before share appreciation. As for the next step, it doesn’t hurt to take the interviews now that all interviewing is remote. PM me for a referral.

Thanks I’ll think about it and see how the next few months goes here, I get stonks and 20% bonus in march so will reevaluate after that is the plan. Leetcode grind would be rough but yeah thats what pros do right?

Somebody somewhere posted about something that outlined what people starting out make at Microsoft, google, and Meta. Any idea where that is?