Developing Web Applications for Practice. Decided to try and build a site that has a collection of games. What resources can I use to begin?

Hello StackOverFlow Community

I am currently working on my web development and web application development skills. The goal of this small project is to develop a web app that takes the source code of several opensource HTML5 games along with JS games to be accessible all from one application.

I am not asking for advice on the code I need to write such an application because I am familiar with the tools. I am simply asking where I can start with developing such an app. (e.g. resources, youtube videos, etc.)

I created a UI mockup of what the site should look like. It is relatively simplistic.

UI Mockup at a Basic Level

Any advice is greatly appreciated.

how to find item array into array in java script

I do this system but I cannot output from this I exactly want name:’mancing’or ‘mancing’
can anyone solve this problem

const data = [
  [name = 'john doe', name2 = 'hello'],
  [age = 23],
  [hobby = [{
    name: 'mancing'
  }]]
];
data.map((item, key) => console.log(item, key))

AWS Cognito Authentication in Javascript

for my web application I need to login towards AWS Cognito.
But other parts of my website requires the authorization code.

So, this is my code:

    function signInButton() {
      var authenticationData = {
        Username : document.getElementById("inputUserName").value,
        Password : document.getElementById("inputPassword").value,
      };

      var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);

      var poolData = {
        UserPoolId : _config.cognito.userPoolId,
        ClientId : _config.cognito.clientID,
        ClientSecret : _config.cognito.clientSecret,
      };

      var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);

      var userData = {
        Username : document.getElementById("inputUserName").value,
        Pool : userPool,
      };

      var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);

      cognitoUser.authenticateUser(authenticationDetails, {
        onSuccess: function (result) {
          var accessToken = result.getAccessToken().getJwtToken();
          console.log(accessToken);
          console.log(result);
        },

        onFailure: function (err) {
          alert(err.message || JSON.stringify(err));
          console.log(userData);
        },
      });
    }

I get successfully the token, but how can I obtain the authCode?

How to fetch user information from instagram without user authendication using nodejs

I am trying to fetch user information from instagram but now instagram sending request to the user to allow me to fetch their information and then only I can get their data

Will there be any way to make this process App to App communication without user concern

GET AUTH CODE

app.get("/get-auth-code", (req, res, next) => {
console.log(INSTA_REDIRECT_URI);
return res.send(
`<a href='https://api.instagram.com/oauth/authorize?  client_id=${INSTA_APP_ID}&redirect_uri=${INSTA_REDIRECT_URI}&scope=user_media,user_profile&response_type=code'> Connect to Instagram </a>`
  );
 });

To Get Access Token From Instagram API

app.get("/getAccessToken",asyncHandler((req, res, next) => {
    request.post(
      {
        url: "https://api.instagram.com/oauth/access_token",
        form: {
          redirect_uri: INSTA_REDIRECT_URI,
          client_id: INSTA_APP_ID,
          client_secret: INSTA_APP_SECRET,
          code: INSTA_AUTH_CODE,
          grant_type: "authorization_code",
       },
     },
      function (err, httpResponse, body) {
        /* ... */
        console.log("err: " + err);
        console.log("body: " + body);
        return res.status(200).json(body);
      }
    );
  })
);

To Get User Details from Instagram API

app.get("/getDetail",asyncHandler((req, res, next) => {
    request.get(
      {
         url: `https://graph.instagram.com/${INSTA_USER_ID}? 
               fields=id,username,media_type&access_token=${INSTA_ACCESS_TOKEN}`,
      },
      function (err, httpResponse, body) {
         /* ... */
        console.log("err: " + err);
        console.log("body: " + body);
        return res.status(200).json(body);
      }
    );
  })
);

So the point is to get users information without getting permission from the user , Is there any way to do this

Why do useEffect and useLayoutEffect show same value?

As I understand it, React executes useLayoutEffect before printing DOM in browser, and useEffect executes after it. For example consider this component:

const App = () => {
  useLayoutEffect(() => {
    console.log(document.body.scrollHeight); // shows 1024
  }, [])

  useEffect(() => {
    console.log(document.body.scrollHeight); // shows 1024
  }, [])

  return (
    <div style={{ height: 1024 }}></div>
  )
}

I expected, it show 0 for useLayoutEffect and 1024 for useEffect, but both show 1024

I thought <div style={{ height: 1024 }}></div> print after useLayoutEffect but apparently it’s not correct…???

my jquery toggle function is not toggling

I’m trying to get the button to toggle between showing text in different languages. When I click the button nothing happens, can someone help out please?

HTML

    <button id="switch-lang">Switch Language</button>
    <p lang="en">eigo</p>
    <p lang="jp">en japon</p>

JS

    $(document).ready(function() {
      $('[lang="jp"]').hide();
      $(document).on('click', '#switch-language', function(){
          $('[lang="en"]').toggle();
          $('[lang="jp"]').toggle();
      });
    });

Get data-Values from Html Span tag to flutter

I have a span tag which looks like this. This has some jquery elements with it

<span data-show="9.032979" data-duration="8.706577"><span data-begin="9.032979" data-dur="2.201314">A-tisket a-tasket </span><span data-begin="11.234293" data-dur="2.163361">A green and yellow basket </span><span data-begin="13.397654" data-dur="2.284812">I wrote a letter to my love </span><span data-begin="15.682466" data-dur="2.05709">And on the way I dropped it, </span></span><span data-show="17.739556" data-duration="8.744531"><span data-begin="17.739556" data-dur="2.216496">I dropped it, I dropped it, </span><span data-begin="19.956052" data-dur="2.193723">And on the way I dropped it. </span><span data-begin="22.149775" data-dur="2.148179">A little boy he picked it up </span><span data-begin="24.297954" data-dur="2.186133">And put it in his pocket. </span></span><span data-show="35.236208" data-duration="8.714168"><span data-begin="35.236208" data-dur="2.186133">A-tisket a-tasket </span><span data-begin="37.422341" data-dur="2.186133">A green and yellow basket </span><span data-begin="39.608474" data-du

Scenario I’m working on , this span contains a rhyme. and I have an audio for the rhyme. I want to animate the rhyme text along with the audio. Duration and when the animation begin is inside the span tag as data-duration and data-begin respectively. How can I animate the values of span tag with the data-duration of span tag in Flutter.

Maximum call stack size exceeded unit testing angular

after adding a property in my test file the following error is showing while exectution

An error was thrown in afterAll
Error: Uncaught (in promise): RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded

i saw in web the answer they are showing is there may be a recursive function in your ts file ,but that is not the case there , i also make sure that i am using the current version of google chrome.

template not rendering nuxt

I just started nuxtjs today and I already can’t seem to render the template on my localhost, is something wrong?

<template>
  <div>
    <h1>Hi</h1>
  </div>
</template>

<script>
export default {
  name: 'IndexPage'
}
</script>

Get distance between two finger on mediapipe using javascript with regards to z position

I am trying to detect if the tip of thumb and index finger has touched each other. But I am not sure if I am doing this correctly.

const hand = result.multiHandLandmarks[0]; //Returns {x,y,z} of each landmark.
//hand[4] is the tip of the thumb  - Returns {x,y,z} of the tip of thumb.
//hand[8] is the tip of the index finger - Returns {x,y,z} of the tip of index finger.


//I don't know exactly if I am doing this right to get the distance between two tip of fingers.
const x = hand[4].x - hand[8].x;
const y = hand[4].y - hand[8].y;
const z = hand[8].z;

const distance = Math.sqrt(x * x + y * y);

const element = document.getElementById("card")


//--Here I want to check if the user's index and thumb finger is touching each other.
//if it is, then move the element based on the position of index finger.


I have tried doing it this way, but it seems like not the best way to do it.


//I'm not sure about 0.045, if it's enough distance to detect a touch between two finger.
if (distance <= 0.045) {
     element.style.left = `${indexFinger.x - element.offsetWidth / 2}px`;
     element.style.top = `${indexFinger.y - element.offsetHeight / 2}px`;
     console.log("grabbing");
} else {
     console.log("NOT Grabbing", distance, z);
}

Also I want to consider the Z position of index finger, if the hand is too close to the camera, then I want to popup some alert to notify the user to move his hand away in a perfect position. Because I think, the X and Y depends on the Z position. If a hand is too close to the camera the x and y returns higher number.

A promise is returned instead of firebase data

How can I fix this? I have no idea what event loops, promises, async or await are. You can send me a link to an explanation, or just write me an explanation. However, this is not the main issue. The issue is that I am trying to get firebase data in a function starting on line 38, and I am getting [Object object] instead of the data. But, if I look into the firebase console, it’s giving me [Object Promise] Here is the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p id="i"></p>
    <script type="module">
        // Import the functions you need from the SDKs you need
        import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.7/firebase-app.js";
        import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.7/firebase-analytics.js";
        import { getDatabase, ref, set, get, child} from "https://www.gstatic.com/firebasejs/9.6.7/firebase-database.js";
        // TODO: Add SDKs for Firebase products that you want to use
        // https://firebase.google.com/docs/web/setup#available-libraries
      
        // Your web app's Firebase configuration
        // For Firebase JS SDK v7.20.0 and later, measurementId is optional
        const firebaseConfig = {
          apiKey: "AIzaSyCnfB3Tfu9bo7PyEvhB1ZAPBbit7ZWm9D8",
          authDomain: "square-1cdce.firebaseapp.com",
          projectId: "square-1cdce",
          storageBucket: "square-1cdce.appspot.com",
          messagingSenderId: "82191280296",
          appId: "1:82191280296:web:45e62faffbb7e8a94cfa9d",
          measurementId: "G-NT53HS3WE9"
        };
      
        // Initialize Firebase
        const app = initializeApp(firebaseConfig);
        const analytics = getAnalytics(app);
        const db = getDatabase()
        const dbRef = ref(getDatabase());
        var data={};
        var x=prompt("Message:")
get(child(dbRef, "text")).then((snapshot) =>function(){
  if (snapshot.exists()) {
    data=snapshot.val()
  } else {
    data="No data available"
  }
}).catch((error) => {
  console.error(error);
});
        set(ref(db, 'text/'), {
          texts: get(ref(db, 'text/'))+"<br>"+x
        });
        document.getElementById("i").innerHTML= data;
        </script>
</body>
</html>

Ps. I am a ten-year-old learning javascript. My father signed me up for classes.
Pss. I made the read and write values in the rules true, so anybody can change the data with this code.
Psss. Pressing on “run code snippet” will not work. You would have to run this code from an IDE.

I do not understand how this JS code is working; how are these two lines being returned?

let specificSuffix = function(words, suffix) {
  if (!Array.isArray(words)) {
    return [];
  }
  return words.filter(function(word){
 return word.endsWith(suffix)
  });
}

console.log(specificSuffix(['family', 'hound', 'catalyst', 'fly', 'timidly', 'bond'], 'ly'));
// [ 'family', 'fly', 'timidly' ]
console.log(specificSuffix(['simplicity', 'computer', 'felicity'], 'ily'));
// [ ]

I’m confused specifically about:

return words.filter(function(word) {
return word.endsWith(suffix)
});
}

How am I returning both of these things? The filter is saying, return this empty new array, fill it with the words that endWith the suffix… (I think)

It’s really just the two returns that are throwing me. How does this work?

How to blend navigation bar and background picture in html css

I have been trying to create a website using HTML and CSS by watching a tutorial. As in the tutorial they have their Navigation bar and background blended in I did everything the same as their code except for a few pictures but my nav bar has a sharp outline which is pretty visible

my website

tutorial’s website

I’m just learning HTML and CSS so any help is appreciated. Thanks!



*{
    margin: 0;
    padding: 0;

}

.navbar{
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    cursor: pointer;
  
 
}
.nav-list{
   width: 50%;
  
   align-items: center;
   display: flex;
}

.nav-list li{
    list-style: none;
    padding: 20px 30px;

}

.nav-list li a{
text-decoration: none;
color: white;
}
.nav-list li a:hover{
    text-decoration: none;
    color: blue;
    }

.rightNav{
   
    width: 50%;
    text-align: right;
}


.logo{
    width: 20%;
    display: flex;
    justify-content: center;
    align-items: center;

}

.logo img
{
    width: 35%;
    border: 3px solid white;
    border-radius: 50px;
}


#search{
    padding: 5px;
    font-size: 17px;
    border: 2px solid goldenrod;
    border-radius: 9px;
}


.background{
    background: rgba(0, 0, 0, 0.7) url(/img//back.jpg) ;
   
    background-size: cover;
    background-blend-mode: darken;
}

.box-main{
display: flex;
justify-content: center;
align-items: center;
color: white;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
max-width: 50%;
margin: auto;
height: 80%;
}




.firsthalf{
    width: 80%;
    display: flex;
    justify-content: center;
    flex-direction: column;

}

.sndhalf{
    width: 30%;
    
}


.firstsection{
    height: 100vh;  
}

.sndhalf img{
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    /* width: 60%;

    border: 4px white;
    border-radius: 150px; */
    display: block;
    margin: auto;
}




<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/style.css">
    <title>ABCD</title>
</head>

<body>
    <nav class="navbar background">
        <ul class="nav-list">
            <div class="logo"><img src="img/logo" alt="logo"></div>
            <li><a href="#home">home</a></li>
            <li><a href="#about">about</a></li>
            <li><a href="#Services">Services</a></li>
            <li><a href="#Contact_us">contact Us</a></li>
        </ul>
        <div class="rightNav">
            <input type="text" name="search" id="search">
            <button class="btn btn-sm">search</button>
        </div>
    </nav>
    <section class="background firstsection">
        <div class="box-main">
            <div class="firsthalf">
                <p class="big-text">big text</p>
                <p class="small-text">small text</p>

Adding The data into another spreadsheet

Continuing from previous question

This code recodes the last edited data from Spreadsheet A Sheet1 into the same Spreadsheet A Sheet2, but I want that data (Spreadsheet A Sheet1) to be added into another Spreadsheet B Sheet2

I couldn’t configure how to modify the code since it looks a little complex to me.

Can you please help me to modify this code?

function onEdit(e) {
  const range = e.range;
  const sheet = range.getSheet();
  if (sheet.getSheetName() != "Sheet1" || range.rowStart == 1) return;
  const col = range.columnStart - 1;
  const [header, ...values] = sheet.getDataRange().getDisplayValues();
  const value = values[range.rowStart - 2];
  const v = [[`${value[0]} - ${value[1]}`, `${header[col]} - ${value[col]}`]];
  e.source.getSheetByName("Sheet2").getRange("A2:B2").setValues(v);
  
}