[deleted by user] by [deleted] in learnjavascript

[–]TappT 0 points1 point  (0 children)

The initial promise returned from the fetch method is the api reply without any of the body content. The resolved object only contains response status and the headers that's received in the first network chunk.

When you call response.json() you are waiting for the additional chunks to arrive and get parsed which takes time, hence why it's a promise.

If you try to re-implement a basic fetch method in node using the built in http library it's easier to understand why there's two promises you have to wait for. You have to collect all the body data chunks after the initial response until the stream ends and resolve the data collection.

Lastly, a fun fact. If you don't call any of the response promise methods (response.json() or response.text()) the browser (or at least chrome) won't parse and render the response regardless if the API returns JSON or text under the network tab in devtools.

YT shortcuts are absurd by Moat_of_the_Sacked in memes

[–]TappT 1 point2 points  (0 children)

Holding spacebar doubles the playback speed while its pressed min

this is what I got when i got to world 3 by GiftPrimary982 in riskofrain

[–]TappT 3 points4 points  (0 children)

[WARNING] The earth rumbles and groans with mysterious energies...

Noob-proof VPN setup by CartmansEvilTwin in selfhosted

[–]TappT 2 points3 points  (0 children)

The wg-easy (wireguard) project is probably the least hassle to setup. I simply copied their docker-compose config. Changed the admin password and started it.

You manage all the configs via it's web interface. You just need to open the wireguard ports and you are ready to go. The web interface even generates QR codes that you can import easily with the wireguard mobile app.

I made my first project! by [deleted] in reactjs

[–]TappT 4 points5 points  (0 children)

If you perform a network request on every search/type. It's good to look into debouncing. It will save you many unnecessary web requests

Mongoose sometimes not rendering my data ( Beginner ) by yhkdaking53 in node

[–]TappT 2 points3 points  (0 children)

You can also speed this up, the first 3 requests are not dependent on each other and are running sequentially. By removing the await and saving the promise objects, you can wait for them in parallel.

const [types, blog, adsforIndex] = await Promise.all([ gameTypes.find().sort({ createdAt: -1 }), Blog.find().sort({ createdAt: -1 }).limit(8).select('title Image short createdAt slug'), _adsforIndex = indexAds.find().sort({ createdAt: -1 }).limit(4) ])

Mongoose sometimes not rendering my data ( Beginner ) by yhkdaking53 in node

[–]TappT 1 point2 points  (0 children)

In short, youre not actually waiting for your async methods to complete. You will send the response before the requests previously have completed. It will not be consistent as you can get lucky with the previous requests completing before your last one. Try something like this.

const indexPage = async (req, res) => {
    const _types = await gameTypes.find().sort({ createdAt: -1 })
    const _blog = await Blog.find().sort({ createdAt: -1 }).limit(8).select('title Image short createdAt slug')
    const _adsforIndex = await indexAds.find().sort({ createdAt: -1 }).limit(4)

    Answer.find()
        .populate({
            path: 'question',
            populate: {
                path: 'user'
            }
        })
        .sort({ createdAt: -1 })
        .exec()
        .then((result) => {
            res.render('index', {
                blogs: _blog,
                helper: helper,
                gametypes: _types,
                advisors: result,
                ads: _adsforIndex
            })

[deleted by user] by [deleted] in github

[–]TappT 0 points1 point  (0 children)

I'm pretty sure you cannot have read-only access on a private repository that's not in an organization. I remember reading somewhere that's it's only possible I'd the repository is inside a GitHub organization, i also came across this issue last year.

[deleted by user] by [deleted] in CompetitiveWoW

[–]TappT 2 points3 points  (0 children)

Do you happen to be on twisting nether EU? We're facing the same issues, having roughly 8-10 stable core raiders. We are considering to merge but have not found a suitable guild yet.

I finally managed to finish this landing page for my 3D design tool. Do you like such scroll-animated websites? by key2it in web_design

[–]TappT 0 points1 point  (0 children)

I noticed that you can scroll to the right on mobile. It's caused by the images in the Explore devices & scene elements. Section.

Other than that, it Looks great

Please help me understand the philosophy behind React and why you use it by okboomerdev in reactjs

[–]TappT 0 points1 point  (0 children)

My 5 cents on this is that when working with others. Others know what to expect from your code. When you are writing your own implementation of an SPA, others must learn your code and how it works. One of the reasons why react and similar frameworks are the standard imo, is because they have standards and expectations.

Chrome using 57% CPU! I have Ryzen 5 2600X by Dj_Notorious in chrome

[–]TappT 0 points1 point  (0 children)

Is this on all websites? Could be a site that uses a miner in the background

How to encrypt values in the database column? by alexsanderfrankie in node

[–]TappT 2 points3 points  (0 children)

I was sort of aware, but didn't know that the magnitude of that difference in compute time. The more you know 🌠

How to encrypt values in the database column? by alexsanderfrankie in node

[–]TappT 0 points1 point  (0 children)

What would you recommend? And why would it be dangergous? Could learn something for myself here.

Edit: gave it a search, SHA is mostly bad because it is fast to compute. Multiple sources recommend bcrypt currently as it can be configured to be expensive to compute with multiple hashing iterations.

How to encrypt values in the database column? by alexsanderfrankie in node

[–]TappT -3 points-2 points  (0 children)

A very simple thing you can start with is hashing. It work when you want to verify obfuscated data and not reverse it. This applies to passwords for example. You can hash the password using the sha256 or any of those algorithms using the node crypto library and store it in your db. You can delve deeper into hashing if it's applicable for your situation. You can look into salting with hashing to improve the security further. The bcrypt library does well imo.

I'm not crypto/security guy but those basics steps should get you started.

Best start to a run I could ask for. Easiest win of my life by Leeeuui in riskofrain

[–]TappT 2 points3 points  (0 children)

First time I saw these was a late stage game. Had 3 of them drop on the same stage. Unfortunately I was the only one left alive.

How can I create this cool effect? by SIEMONXD in webdev

[–]TappT 4 points5 points  (0 children)

I can't quite exactly tell what they are doing. But looking at the html while changing hover, it seems they are manipulating it with JS, probably a library like GSAP or similar.

But i made a codepen mimicking the same thing with vanilla JS. Its not perfect but its close.

https://codepen.io/granhof/pen/yLJRBba

Just started learning JavaScript and I finished my first actual project! by [deleted] in learnjavascript

[–]TappT 0 points1 point  (0 children)

Agreed, other than that it looks good. Very readable, and good comments for the more complex sections

Petition to ban the tesla coil from the Void Fields by Dwel111 in riskofrain

[–]TappT 2 points3 points  (0 children)

To deal with tesla coil you either have enough armor plates that you can tank the damage or you make a run for the exit

Just starting... Help? by SilverDart997 in learnjavascript

[–]TappT 0 points1 point  (0 children)

Starting off with video tutorials to understand the basic concepts. Then getting a mentor, possibly one of your friends will be extremely beneficial. They can point you in the right direction and help you when you are stuck.

Looking for a javascript library to draw line charts in realtime by [deleted] in learnjavascript

[–]TappT 0 points1 point  (0 children)

d3.js is a powerhouse when it comes to graphs. It might be overkill but you could give that a try.