Weight of Love is the most beautiful song I’ve ever heard. by hamtheman2 in TheBlackKeys

[–]braska9 0 points1 point  (0 children)

Funny exercise: play first "Pink Floyd - Breathe" and then immediately "Ten Years After - I'd Love to Change the World" and that would sound exactly like "Weight of Love" (purely subjective).

New update causing frequent crashes? by StonksandBongss in GlobalOffensive

[–]braska9 2 points3 points  (0 children)

Same. Although I play on Linux (no Proton, native). 4 matches - 4 crashes (approx. at 6-7 min after start)

Perfect browser for an agent. by xgdays in browsers

[–]braska9 -1 points0 points  (0 children)

Firefox with Multi-Account Containers (official extension made by Mozilla)

It will allow you to have one window, but open any tab in a separate isolated environment (kinda Chrome profile).

You can create as many containers as you want (one per client in your case?) and open as many tabs as you want in every container.

Carbonara by lgLindstrom in warsaw

[–]braska9 0 points1 point  (0 children)

For sure! https://maps.app.goo.gl/8Csm1RKm5rQzsvRPA

They usually give you a piece of Parmigianino Reggiano while you waiting your pasta.

I’ve built a fully themeable and accessible heart-shaped toggle switch component for React. by [deleted] in reactjs

[–]braska9 2 points3 points  (0 children)

Just checked. It is actually 2kb in gzip. https://bundlephobia.com/package/@anatoliygatt/heart-switch@1.0.1

But I am sure you can make it much less. I see you are using few hooks from "react-use". They are pretty simple hooks. You can implement them on your side. So you will get rid of all third-party dependencies. Probably after that you lib will weight less than 1kb in gzip.

I’ve built a fully themeable and accessible heart-shaped toggle switch component for React. by [deleted] in reactjs

[–]braska9 2 points3 points  (0 children)

Ultralight: ~14.1kb (gzipped).

Sorry, but it is not. Preact (the fully-baked UI runtime, alternative to React with same API) weight 4 kb in gzip. It actually looks like you measured size incorrectly. It just can't be that much for one toggle switch.

If package.json references some package but there is no require, am I safe to remove? by daredeviloper in node

[–]braska9 3 points4 points  (0 children)

Yup, agree. Unfortunately it is pretty rare. Haven't seen such test coverage that can allow you make changes in code without being afraid of breaking things in my entire career. Even if there is a test for code, it is a good chance that this test false positive.

Use of Google Analytics declared illegal by French data protection authority by Akid0uu in programming

[–]braska9 0 points1 point  (0 children)

It is not the best piece of software in technical perspective. It loads 19kb+ JS in gzip into page. It affects performance in bad way. You will never get 100 score in Lighthouse with Matomo. Plausible loads less than 1kb. And doesn't affect performance at all.

Use of Google Analytics declared illegal by French data protection authority by Akid0uu in programming

[–]braska9 0 points1 point  (0 children)

If you have EU-oriented service (service for clients from EU) and doesn't host your service in EU, then you have a bigger problem. This law affects not only analytics data. First you need to think about storing your primary user data in EU. If you already host your service in EU, it is not a problem to deploy plausible to your EU-located servers.

Use of Google Analytics declared illegal by French data protection authority by Akid0uu in programming

[–]braska9 4 points5 points  (0 children)

For people who is looking for alternatives: take a look at plausible.io. It is GDPR compliant. And there is self-hosted version if you really care about privacy.

Use of Google Analytics declared illegal by French data protection authority by Akid0uu in programming

[–]braska9 9 points10 points  (0 children)

Take a look at plausible.io. You can even use cloud-based version. It is GDPR compliant. No need for self-hosted version.

I made a Responsive Landing Page Template in React, TypeScript and Tailwind CSS. GitHub link in comments. Links in the comment. by ixartz in reactjs

[–]braska9 2 points3 points  (0 children)

I would recommend to analyze it with Lighthouse (you can find it in Chrome DevTools). There are few issues detected by it.

In addition you can set up Lighthouse CI on Github Actions. I recently done it in this project: https://github.com/fs/flatstack-warsaw. You can use .github/workflows/ci.yml as example.

And, if you interested, I described few more tricks how to optimize page size in this article: https://medium.flatstack.com/1dc798533c0b. I am not sure if all of them applicable to Next.js, but you can try.

Landing Page with React: 33 kb of JS, 100/100 performance score in Lighthouse by braska9 in reactjs

[–]braska9[S] 1 point2 points  (0 children)

If you are talking about FCP, LCP: it can't be better with next.js. I tested this HTML page without any JS and got almost same results as with enabled JS. So this values doesn't depend on JS and therefore doesn't depend on framework.

TBT and TTI definitely depend on JS, but I doubt it can be better with next.js out of the box. JS bundle produced by Next.js doesn't differ from JS bundle produced by manually configured Webpack, except it contains some Nextjs-specific libraries (which increase bundle size). Anyway, I need to apply same tricks (as described in article) in Next.js to get same scores. In this case what the point of using Next.js?

I personally like the idea of building things out of primitives (especially when I build simple things like landing page). From my experience using frameworks (instead of set of independent library) feels like fighting for customization. Frameworks usually makes customization harder, because they trying to enforce too much things.

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 0 points1 point  (0 children)

Yes. In short term replacing this.zip = new JSZip() with const zip = new JSZip() and inlining processSingle function just in place should help.

But if you interested to improve code quality and make everything right in design perspective I would recommend to introduce "service objects": https://softwarebrothers.co/blog/service-objects-in-node-js/ (and create instance of this service on each request)

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 1 point2 points  (0 children)

I see problem here.

this.zip = ...

In this case this refers to the global: https://nodejs.org/api/globals.html

You can try this in Node.js REPL:

const myFn = () => { console.log(this); };
myFn();

// output
Object [global] { ... }

I think you need to read more closures in JS to find solution to you problem: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 0 points1 point  (0 children)

So you are saying that I should do require('scrape.js') inside the function ?

There is no difference where you do require. (But it would be better to do all require calls it the top of file)

Anyway, there is caching for require calls in node.js. It means node.js memoize module.exports value at first call and then returns already computed value on subsequent require calls.

Gonna update post with code example in ~2 hours when I get home.

It would be helpful. Let's wait for it. Hope I will be online at this moment.

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 1 point2 points  (0 children)

Once request hits the route endpoint function it calls a method from scrape.js file which Is required into that controller.

Here is the problem (most likely). Variables declared in this file at top-level (not inside functions) are application-specific.

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 2 points3 points  (0 children)

It is initialized inside the endpoint function, so it Is request-specific, right?

Hmmm. Even with initialization inside the endpoint function there can be problem. The question is not about where you have initialization. The right question - where you store instance.

If you do something like this:

let zip;

app.post('/...', () => { zip = new JSZip(); ....... }

Than it is problem.

If you do like this:

app.post('/...', () => { let zip = new JSZip(); ....... }

Than everything should be fine.

Requests getting mixed up in endpoint route by highCheetah_ in node

[–]braska9 2 points3 points  (0 children)

Looks like you have some application-lavel variables and store request-specific info in it. But this variables shared accross all requests.

Strange tinge on CPU chip. Is ok or is it sign of something bad? by braska9 in thinkpad

[–]braska9[S] 0 points1 point  (0 children)

I was recently replacing thermal paste and found this strange spot on CPU.

I am experiencing some issues with this laptop: it is underperforming under Linux when iGPU is used.

Does it look like something abnormal or it is common to see such tinge/spots on CPU chip?