I am trying to test an axios request, and I need to use an auth token in order to access the endpoint, however my test fails because I am getting “Bearer null” and inputting this into my headers.Authorization. Here is my actual code below File I’m testing: Test file: How do I mock or get the…
P5.js camera not working with multiple rotation matrices
I’ve been working for some time on making a 3D first person camera in p5.js for games and random projects, but I’ve been having some trouble. For some time now I’ve been using a single y-rotation matrix with my projects to allow the player to look around, but I’ve felt like having an u…
Extracting play function of react-youtube in state to use in button oncluck results in CORS
I am using react-youtube library from npm in my react project. I want to play and pause YouTube video on button onClick event. I have tried extracting the event as well as function from YouTube …
Lookup table with weak references in Javascript
I have a tree structure with elements dynamically added and removed. The elements are loaded dynamically from the network. What I want to achieve is to have a lookup table that maps the element’s id to the actual element in the tree. Now, the problem when using a simple Map or Object is that it holds st…
How do I insert UL element to list
This is my jQuery script so far: From that I have a list like this: How do I add a <ul> right after <nav aria-label=”Page navigation” id=”alphanav”> and add </ul> right before </nav>? I tried to use append but it just added <ul></ul> right after the …
React – How to fix very inconsistent disabled button countdown (i.e., several whole seconds)
I’m using setTimeout() (I even tried driftless too) to change buttons from disabled = true to disabled = false 3 seconds after appearing on the DOM (onLoad=). The buttons appear in sequence, after the previous button has been clicked. The problem is, the setTimeout() goes absolutely haywire: Each button…
How should I call this node.js function?
I’m following a Node.js tutorial, it gave me the following code to start: It asked me to finish the app, so I did this, and it worked: However when I clicked the “check your work” button, it said that I did it wrong. The correct answer ended up being this: I have a couple of questions about …
Unit testing a method that creates a JWT and returns Error: secretOrPrivateKey must have a value
I am trying to write a unit test for the method I wrote which generates a JWT. I am doing the following Note: I am not using expect yet, and seeing if the method works in first place by logging the result of the method to the console And I receive the following error: Error: secretOrPrivateKey must have a val…
How to dynamically find main rectangular image within an image?
I’d like to take a screenshot of an image, and extract the image out of the screenshot. For example: I’d like to dynamically extract that image out of the screenshot. However, I want to be able to dynamically detect where the image to be extracted is in the screenshot image. So for example, if I s…
Is it possible to get/select Alt Text in powerpoint using the JS API?
As far as I can see in the documentation, there is a method exposed to set selected data, however the example in the docs and elsewhere seem to imply that it only receives a base64 image string, which does not contain any info about the alt text. Is there an API exposed to do CRUD operations over the Alt Text