Programming

My friend at the company said 2.5 years or probably less and they don’t want it back. It’s a very small place and they don’t have stuff like policies.

that’ssocialism.gif

2 Likes

https://twitter.com/hackerfantastic/status/1403001704920936457

My employer got hacked (actually our CRM software - hosted on their site) and immediately rolled over like a dog on its belly. These guys do not give a shit about creating a moral hazard.

Geez the speakers on this thing are good. Maybe not good speaker good or anything, but it sure blows away any laptop my cheap-laptop-buying-self has ever heard.

I’m typing this on an ex-work laptop that had strict policies about asset registers and serial numbers etc and they still managed to lose track of it.

Might as well start festooning yours with your own decals already.

1 Like

My almost new MacBook Pro has a dead USB port. I assume it’s still under warranty - but does that mean I have to send it off for weeks or something?

My new MacBook Pro doesn’t have anything I recognize as a USB port but it’s loaded with power ports.

(I know these are some kind of Apple special power/USB ports that mean nothing else will work with them and they’ll change these in 3 years so everyone has to buy new everything)

Those are USB 3 ports. They also work for power.

Thank God they changed. Those USB2 ports were so 2018.

Just put one of those cheap skins over the cover and load it up.

Been on an 8 month project that should have been two weeks. It took 8 months because it was placed in the hands of this crazy russian dude who decided to eschew all company standards and just build out this whole pipeline in a really convoluted and terrible way. Sure enough the team that has to maintain it denies his final pull request, and says we should have done what they asked us to do literally 100 times.

So the russian leaves the team, guess who gets to clean up the code? I just finished in 2 days from scratch what he took 3 months to do. Finishing the last part of everything today, hopefully, and I’m gonna feel pretty awesome if I pull it off. If i don’t, I might get let go. I guess there are tons of eyes on this and everyone’s expecting it to fail, but I think I can bring it through.

It’s funny how much of the job is not technical at all. I was able to push it through in a few days by just doing what they asked, coordinating with the other team, asking for direction, and kissing the right asses to approve my pull requests.

Wish me luck, a lot rides on this.

10 Likes

Wow, now based on a true story.

1 Like

Atleast <redacted> wasn’t company as well.

Hi JavaScript friends, I am seeking help with this ridiculous duct-taped together language.

I’m not running strict mode, here’s some code to illustrate the problem I have:

function MyFunc() {

	this.doTheThing = function() {
		console.log(this);
		window.requestIdleCallback(this.doTheThing);
	}

}

var myFuncInstance = new MyFunc();
myFuncInstance.doTheThing();

On initial execution, myFuncInstance is logged to console. But when window.requestIdleCallback executes, suddenly “this” changes to “window”.

I’m aware that if I set strict mode, “this” will be undefined, which I don’t get. Can’t I just have the sane version (“this” means the owner of the method) and not the insane version (“this” means the global object, which, why on earth would I ever want that?). What am I supposed to do instead of “this” to refer to other properties and methods of this object?

Edit: Having read about this a bit more, I guess I use .bind(this) and hope I don’t create a subtle bug by omitting a single “please give me the object model that I literally always want 100% of the time” somewhere.

Yeah, JS is trash. Arrow functions have lexical this, so you can also make the callback an arrow function to avoid having to worry about this hijinx.

window.requestIdleCallback(() => this.doTheThing)

?

You can also set
const self = this
in the outer function then use self in the callback

Outer scope is lost when a function goes async, replaced by the outer scope of whatever executes the callback.

Also I’m confused as to why you’re having function A execute another function that calls function A as a callback. Is this meant to be recursive?

Also keep in mind that console.log() is async. So what you see in dev tools is the final value of whatever object is logged, not necessarily a snapshot of its value at the time you logged it. To get the snapshot you can use various methods of cloning depending on the nature of the object. Or just log the property you’re interested in as long as it’s a primitive.

And don’t ever use var. Use const or let.

Funny because if you use “let”, jslint says “don’t do that, use var”.

There is literally no case you want to use var. var scope jumps out of its block. If you need it your code smells.

1 Like

I’m looking through the web app JavaScript code of one of the largest sportsbooks in the world. This is a 2020 basically ground-up rewrite of their site which just went live. It’s an unminified unobfuscated vomit of JS, not a framework in sight. The site does EVERYTHING through XHR calls to “transform.php”, which acts as a global endpoint, serving like 100 different endpoint functions depending on what you give it in the POST data. The main page takes about 800 years to load because it has to make legitimately like 80 XHR calls and process each result sequentially.

The responses are - all together now - in XML, obviously. That is, unless they’re giant roll-your-own HTML templates that they interpolate data into and paste into the page. In one response I looked at, one of the XML elements contained a CSS class (“word_green”) which was to be applied to the word “Confirmed” in the displayed response.

Probably my favourite part though is that I set Chrome Devtools network throttling to “Offline” so I could make a bet request and examine it without actually betting, and the thing immediately started spamming the server with like 10 requests/sec, trying to reconnect. So if they’re having connection issues - which they are, all the time - all their web clients start merrily DDOSing them.

2 Likes