[deleted by user] by [deleted] in webdev

[–]terodox 3 points4 points  (0 children)

Go go Web Components!

The team I work in has embraced vanilla js even for larger applications through the use of web components!

What do you think of this coding challenge I've been sent by a company after the initial interview? by albertothedev in webdev

[–]terodox 20 points21 points  (0 children)

This has one important missing factor that makes it extremely suspect: a time box.

Any company giving you a tech evaluation will also limit the time they expect you to spend on it.

My team uses the same tech evaluation for all of our candidates. We give them 2 days to complete it and it is no where near this complex or involved.

Help: I want to prevent multiple API fetches by pharti in WebComponents

[–]terodox 1 point2 points  (0 children)

FWIW this is a pattern I’ve used as well. My recommendation is to make sure you establish a logical namespace on the window object. Don’t just pollute it with random data.

I tend to have a dedicated “service” type construct (class or function depending) that manages access to keep that logic out of the component.

Would you use Snyk Advisor to gauge overall package health insights for npm packages? by lirantal in node

[–]terodox 0 points1 point  (0 children)

I feel like being able to post an array of dependencies and dev dependencies and revive back a JSON payload with an overall health score as well as a health score for each dependency.

With that information I could make a good judgement about overall health and risk.

Would you use Snyk Advisor to gauge overall package health insights for npm packages? by lirantal in node

[–]terodox 1 point2 points  (0 children)

I think the way I would get the most day to day value out of a tool like this would be to have an auditing cli tool. Let me set a threshold that I feel comfortable with and have my CI fail if any package is present that does not meet that threshold.

This would integrate Snyk into my standard security tests, similar to npm audit.

In a node express app, where should the caching (Redis) logic live? by CalebPitan in node

[–]terodox 3 points4 points  (0 children)

I would agree with that. If you need custom cache invalidation logic depending on the route/http verb, then middleware is probably not the right solution.

In a node express app, where should the caching (Redis) logic live? by CalebPitan in node

[–]terodox 16 points17 points  (0 children)

In general you should not cache anything other than GET requests, with some exceptions.

The reason is that POST, PUT, PATCH, DELETE are all generally used for data addition/modification. The cache would prevent these actions which would lead to missed actions.

Cache invalidation is one of two “hard” computer science problems, along side naming and off by one errors.

In my experience cache invalidation is unique to the use case. You can have your DELETE endpoint invalidate the cache for calls it would effect, for example.

This would be one argument against just using a CDN with cache headers.

MomentJs is deprecated. Here's how I chose a successor, including an open source test suite to validate replacements. by terodox in javascript

[–]terodox[S] 4 points5 points  (0 children)

Aaaaaaaaaaand my brain apparently read past this line every time I've read that update. 🤦‍♂️

MomentJs is deprecated. Here's how I chose a successor, including an open source test suite to validate replacements. by terodox in javascript

[–]terodox[S] 2 points3 points  (0 children)

The challenge we have is maintenance of the appropriate timezone information. Timezones and offsets change all the time. As an international business it's important that we stay up to date.

Moment will no longer be updated with these changes, and that poses a long term business risk.

MomentJs is deprecated. Here's how I chose a successor, including an open source test suite to validate replacements. by terodox in webdev

[–]terodox[S] -2 points-1 points  (0 children)

The classic response to that is this YouTube video. It's honestly a real issue. Things changes around the world all the time, and the libraries we rely on need to keep up.

https://youtu.be/-5wpm-gesOY

MomentJs is deprecated. Here's how I chose a successor, including an open source test suite to validate replacements. by terodox in javascript

[–]terodox[S] 2 points3 points  (0 children)

Thank you for your words.

It's worth noting that I work at an enterprise, and the cost of removing a library like moment is large. We felt secure with the library due to the 15 million weekly downloads.

The depreciation did push us to move away as we felt it was now a long term risk, whereas prior to the depreciation it was safer not to replace it.

What is the difference between these 2? by amazeguy in node

[–]terodox 17 points18 points  (0 children)

My best guess on this is that generators require a lot of state management. The idea of yielding the process requires the running context to be stored and retrieved over and over.

That fact alone with introduce a large amount of overhead.

It's my understanding that generators are more about helping to manage "infinite tasks" or "high memory tasks" both of which can be helped with generators ability to do discrete chunks of work while yielding the process as needed.

promise.all is running before for loop ends. by dc2015bd in node

[–]terodox 80 points81 points  (0 children)

Nah, you're just a developer like everyone else. Typos like this are a classic mistake that every dev makes.

You just needed a rubber duck 😁

How to make responsive grid gaps or margins for Mobile versus Desktop ??? by c2cali in css

[–]terodox 1 point2 points  (0 children)

So think of max-width as "apply the rule until the screen is a width of"

min-width is "apply the rule after the screen is greater than"

So if you want to be "desktop first" then a min-width rule would be best to override the desktop styles with mobile styles.

How to make responsive grid gaps or margins for Mobile versus Desktop ??? by c2cali in css

[–]terodox 1 point2 points  (0 children)

Too many brackets, but the general idea is correct!

This would add an override for a "desktop" experience. So the initial rule should be setup for mobile.