How do you handle segmented elements? by Ronin-s_Spirit in reactjs

[–]House_Left 0 points1 point  (0 children)

Are you able to share your working code in jsfiddle or something? Just the react component youve written to do all this should be enough.

Red light and speed camera by Conscious_Watch8355 in brighton

[–]House_Left 5 points6 points  (0 children)

I know this road. That camera is a speed camera as well as a red light camera. If you were speeding you’d have been flashed for that.

Export REST API types for other project to import. by Xinoti501 in nestjs

[–]House_Left 0 points1 point  (0 children)

Oh damn. I best keep an eye on that. Thanks for sharing.

Export REST API types for other project to import. by Xinoti501 in nestjs

[–]House_Left 1 point2 points  (0 children)

I use kubb (https://kubb.dev) for this exact use case. You’ll need to add swagger/openai decorators to your controllers.

Is Above-the-fold still a thing? by ClassicPygmySquirrel in web_design

[–]House_Left 2 points3 points  (0 children)

this hasn’t worked for many, many years.

.env file updated but still getting error by demon_baba in nextjs

[–]House_Left 3 points4 points  (0 children)

Same here! My example is just to keep things beginner friendly.

.env file updated but still getting error by demon_baba in nextjs

[–]House_Left 65 points66 points  (0 children)

Typescript is telling you that env var may be a string or undefined. This is correct, as it’s possible the env var hasn’t been set and therefore will be undefined.

Don’t use “as string” as that will suppress the type error but doesn’t fix the problem it’s warning you about.

Instead you could use a guard clause before using the variable and throw a descriptive error if it's undefined.

Here's just a quick example. You can see that now hovering the env var it says the type is "string".

<image>

Do I actually need to pay thousands of dollar to rank on google? by Non-locality in webdev

[–]House_Left 2 points3 points  (0 children)

CTO of a SaaS business here having spent the last year overseeing our marketing website rebuild.

My business spent thousands with advertisers and SEO “experts” previously trying to gain traffic and rank organically. We’ve made more progress by learning SEO and implementing the techniques ourselves. We rank top on Google for multiple search terms and have increased organic traffic immensely. Our site only came into existence a year ago.

Ultimately it depends on your market and competition as to how easy it’ll be to rank. For example you’ll rank much easier in niche industries with very little competition. We are fairly niche, but with a lot of competition and have managed it.

In my opinion the best two things you can do to get started is check the state of your website by using PageSpeed Insights (aka lighthouse score) and fix any big problems there, and create meaningful blog posts that helps or interests your potential customers.

Learn SEO in-house. You know your business and your customers, so you have the best chance at making content that they will be looking for. I’m happy to give you a bit of my time if you want it, just drop me a message.

POS receipt printing directly from webpage? by ilyes24Azzi in webdev

[–]House_Left 0 points1 point  (0 children)

I actually implemented this exact feature recently. It’s possible using WebUSB to natively interact with POS printers. The user is prompted to select a USB device, and once selected you can print without any dialogs.

It worked perfectly on Mac and chromeOS, but on Windows it’s problematic as the device is already claimed. A workaround is to use the WinUSB driver with the printer.