October 22, 2024
Chicago 12, Melborne City, USA
javascript

chatgpt roasts computer science engineer

here’s my small roast by chatgpt, plz dont judge it, I’m a student asking gpt many question. Alright, Anchal, strap in—this roast is going to come in hot and honest, just like your dream of coding your way to San Francisco while struggling with palindrome questions. 😜 So you’re aiming for a software engineering job

Read More
javascript

How to fix 15: exec: node: not found in a NodeJS project with Typescript on Windows?

I’m new to Nodejs and Typescript and facing a problem on a Windows machine. I set up an empty project with a single index.ts just for testing. I’m also using nodemon. When I use tsc command to generate js files from ts, it works without any error and the files are built in the build

Read More
javascript

Angular async – how to get the string of an async method

I use this service class in order to get the network status: @Injectable() export class NetworkConnectionService { constructor() { } addNetworkConnectionListener() { Network.addListener('networkStatusChange', status => { console.log('Network status changed', status); }); } getCurrentNetworkStatus() { const self = this; const currentNetworkStatus = async () => { const status = await Network.getStatus(); }; return currentNetworkStatus; } }

Read More
javascript

angular/fire@7 storage is not working for my Angular 16 app

I’m trying to use angular/fire@7 storage to store files and I’m getting this error: Error: Uncaught (in promise): Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you’re calling an AngularFire method outside of an NgModule (which is not supported). Error: Either AngularFireModule has

Read More
javascript

Testing a react component library project using vite

I have a library project using TS, React, and vite for bundler. Folder structure looks like this - LibraryProject - src - main - TestComponent.tsx - hooks - hookFile.ts - enums - enumFile.enum.ts My current vite config builds a lib properly and I am able to use that in a separate React demo project. To

Read More
javascript

How can you check if a javascript map has a duplicate key

I’m working with a Map in JavaScript and need to check that it doesn’t contain duplicate keys. The map I’m working with is below. const colors = new Map([ [1, 'blue'], [2, 'orange'], [1, 'pink'], // This duplicate key should trigger an error [3, 'yellow'], ]); In this situation because the number 1 is used

Read More
javascript

next js middleware infinite redirects

I want to protect my home page if the user is not authenticated he shouldn’t have access to it , a user is authenticated if a cookie exists , if the user is logged in and attempts to change url to login page he should get redirected to home page using next js middleware the

Read More
javascript

Error fetching user data: Cannot read properties of undefined (reading 'request')

Problem: I’m trying to fetch user data from Auth0 using their Management API in my Express app, but I’m encountering the following error: Error fetching user data: Cannot read properties of undefined (reading ‘request’) Failed to update user metadata: Error: Failed to fetch user data from Auth0 This error occurs when making the Axios request

Read More
javascript

Styled Unicode Characters to Plain Text

I have this code that converts plain text to Unicode styled characters: function convertText(text, style) { // 1. Convert the text to the bold type with the unicode. const conv = { c: function(text, obj) {return text.replace(new RegExp(`[${obj.reduce((s, {r}) => s += r, "")}]`, "g"), e => { const t = e.codePointAt(0); if ((t >=

Read More
javascript

Overlapping lines weeks

I have datasets with date time as x-axis. I did split the datas by weeks like "2024W41", "2024w42"… I would like to display two lines, one for each week. Sadly, as its based on date for x-axis, the first week appears left, the second one appears next, to the right of it. Its logical. How

Read More