INSERT/RETRIEVE RECORDS FROM GOOGLE SHEETS - STANDALONE GOOGLE APPS SCRIPT

 Code from the video:

Code.gs

// =================== GOOGLE SHEET ========================

function addRecord(schoolId, name, address, bday, course){
  try{
    var spreadSheet =SpreadsheetApp.openById("1CdIPDw67KdKHFRWW9M6-tIwfKz_M40as-8p4N2cM-zE");
    var sheet = spreadSheet.getSheetByName("Sheet1");

    sheet.appendRow([schoolId, name, address, bday, course]);

    return 1;
  }catch(error){
   return error;
  }
}
function getStudents(){
  try{
    var spreadSheet =SpreadsheetApp.openById("1CdIPDw67KdKHFRWW9M6-tIwfKz_M40as-8p4N2cM-zE");
    var sheet = spreadSheet.getSheetByName("Sheet1");

    var range = sheet.getDataRange();
    var values = range.getValues();

    return JSON.stringify(values);
  }catch(error){
   return error;
  }

}

Sheet.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <script>
      function submit(){
        const schoolId = document.getElementById("schoolId").value;
        const name = document.getElementById("name").value;
        const address = document.getElementById("address").value;
        const bday = document.getElementById("bday").value;
        const course = document.getElementById("course").value;

        google.script.run.withSuccessHandler(
          function(response){
            if(response == 1){
              alert("Records has been successfully added!");
              updateDisplay();
            }else{
              console.log(response)
              alert("Record not saved " + response);
            }
          }
        ).addRecord(schoolId, name, address, bday, course);
      }

      function updateDisplay(){
        var tableBody = document.getElementById("tableBody");
        tableBody.innerHTML = "";
        var myHtml = "";
        google.script.run.withSuccessHandler(
          function(students){
            if(students){
              students = JSON.parse(students);
              for(i=1;i<students.length;i++){
                var row = document.createElement("tr");
                row.innerHTML = `
                  <td style="border:1px solid black; padding: 5px;">${students[i][0]}</td>
                  <td style="border:1px solid black; padding: 5px;">${students[i][1]}</td>
                  <td style="border:1px solid black; padding: 5px;">${students[i][2]}</td>
                  <td style="border:1px solid black; padding: 5px;">${formatDate(students[i][3])}</td>
                  <td style="border:1px solid black; padding: 5px;">${students[i][4]}</td>
                `;
                tableBody.appendChild(row);
              }
            }else{
              alert("NO STUDENTS FOUND!")
            }
          }
        ).getStudents();
      }

      function formatDate(dateString){
        var date = new Date(dateString);
        var formatter = new Intl.DateTimeFormat('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
        return formatter.format(date); // Example: Dec 4, 2011
      }

      document.addEventListener("DOMContentLoaded",
        function(){
          updateDisplay();
        }
      );


    </script>
  </head>
  <body>
    <h1>GOOGLE SHEETS CRUD SERIES</h1>

    <h1>ADD STUDENTS</h1>
    <input type="text" id="schoolId" placeholder="Enter School ID"/><br/>
    <input type="text" id="name" placeholder="Enter NAME"/><br/>
    <input type="text" id="address" placeholder="Enter ADDRESS"/><br/>
    <input type="text" id="bday" placeholder="Enter BIRTHDAY"/><br/>
    <input type="text" id="course" placeholder="Enter COURSE"/><br/>
    <button onclick="submit()">Submit</button>
    <br/><br/>
    <h1>RETRIEVE STUDENTS</h1>
    <table style="border:1px solid black; border-collapse:collapse;">
      <thead>
        <tr>
          <th style="border:1px solid black; padding: 5px;">SCHOOL ID</th>
          <th style="border:1px solid black; padding: 5px;">NAME</th>
          <th style="border:1px solid black; padding: 5px;">ADDRESS</th>
          <th style="border:1px solid black; padding: 5px;">BIRTHDAY</th>
          <th style="border:1px solid black; padding: 5px;">COURSE</th>
        </tr>
      </thead>
      <tbody id="tableBody">

      </tbody>
    </table>

  </body>
</html>







UNITY: 2D ANIMATION

 CODE FROM THE VIDEO:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Player : MonoBehaviour {
  Rigidbody2D playerRB;
  BoxCollider2D playerCollider;

  float moveSpeeed = 200.0f;
  float direction;

  float jumpHeight = 5.0f;
  LayerMask groundLayer;
  bool playerIsGrounded = false;
  bool doubleJumped = false;
  AudioSource[] audioSources;

  Animator playerAnimator;

  // Use this for initialization
  void Start () {
    playerRB = GetComponent<Rigidbody2D>();
    playerCollider = GetComponent<BoxCollider2D>();
    groundLayer = LayerMask.GetMask("Ground");
    audioSources = GetComponents<AudioSource>();
    playerAnimator = GetComponent<Animator>();
  }

  private void FixedUpdate() {
    playerIsGrounded = Physics2D.IsTouchingLayers(playerCollider, groundLayer);
  }
 
  // Update is called once per frame
  void Update () {
    direction = Input.GetAxisRaw("Horizontal");
    move(direction);

    // JUMP ROUTINE
    if(playerIsGrounded){
      doubleJumped = false;
    }
    //for the first jump
    if(Input.GetKeyDown(KeyCode.Space) && playerIsGrounded){
      jump();
    }
    //for the second jump
    if(Input.GetKeyDown(KeyCode.Space) && !playerIsGrounded && !doubleJumped){
      jump();
      doubleJumped = true;
    }
    // END JUMP ROUTINE

    // =============== ANIMATIONS =============================

    playerAnimator.SetFloat("Speed", Mathf.Abs(direction));
    playerAnimator.SetBool("Grounded", playerIsGrounded);

    // =============== END ANIMATIONS =============================

    if(transform.position.y < -3){
      //game over
      SceneManager.LoadScene("GameOverScene");
    }

  }

  void move(float direction){
    if(direction == 1){
      transform.localScale = new Vector3(1, 1, 1);
    }else if(direction == -1){ //should use this condition so that the character will not always face the left
      transform.localScale = new Vector3(-1, 1, 1);
    }
    float velocity = direction * moveSpeeed * Time.deltaTime;
    playerRB.velocity = new Vector2(velocity,playerRB.velocity.y);
  }
  void jump(){
    playerRB.velocity = new Vector2(playerRB.velocity.x, jumpHeight);
    audioSources[0].Play();
  }

  private void OnCollisionEnter2D(Collision2D otherObject) {
    if(otherObject.transform.tag.Equals("Obstacle")){
      PlayAudio(1);
    }else if(otherObject.transform.tag.Equals("Enemy")) {
      PlayAudio(2);
    }
  }

  private void OnTriggerEnter2D(Collider2D otherObject) {
    if(otherObject.transform.tag.Equals("Enemy")){
      Debug.Log("Game Over!");
    }
  }

  void PlayAudio(int index){
    StopAllAudio();
    audioSources[index].Play();
  }

  void StopAllAudio(){
    for(int i=0;i<audioSources.Length;i++){
      if(audioSources[i].isPlaying){
        audioSources[i].Stop();
      }
    }
  }


}


FLUTTER: WORKING WITH RANDOM NUMBERS

 Code as seen in the video:

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:lessons/second_page.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _answerController = TextEditingController();
  int _n1 = 0;
  int _n2 = 0;
  int _min = 1;
  int _max = 9;

  String _remarks = "";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text(
            'Hello World',
            style: TextStyle(color: Colors.white),
          ),
          centerTitle: true,
          backgroundColor: Colors.blue,
          elevation: 10.0,
        ),
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(10.0),
            child: Column(
              children: [
                const Text(
                  "Addition for Kids",
                  style: TextStyle(color: Colors.blue, fontSize: 30.0),
                ),
                const SizedBox(
                  height: 20.0,
                ),
                Text(
                  _n1.toString(),
                  style: const TextStyle(
                    fontSize: 30.0,
                  ),
                ),
                const SizedBox(
                  height: 20.0,
                ),
                Text(
                  _n2.toString(),
                  style: const TextStyle(
                    fontSize: 30.0,
                  ),
                ),
                const SizedBox(
                  height: 20.0,
                ),
                TextField(
                  controller: _answerController,
                  textAlign: TextAlign.center,
                  style: const TextStyle(
                    fontSize: 15.0,
                  ),
                  decoration: InputDecoration(
                    labelText: " Your Answer ",
                    hintText: "Enter your answer here...",
                    border: OutlineInputBorder(
                      borderSide: const BorderSide(
                        color: Colors.red,
                        width: 1.0,
                      ),
                      borderRadius: BorderRadius.circular(5.0),
                    ),
                  ),
                ),
                const SizedBox(
                  height: 10.0,
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    Expanded(
                      child: ElevatedButton(
                        onPressed: () {
                          setState(() {
                            _n1 = Random().nextInt(_max - _min + 1) + _min;
                            _n2 = Random().nextInt(_max - _min + 1) + _min;
                            _answerController.clear();
                            _remarks = "";
                          });
                        },
                        child: const Text("Generate"),
                      ),
                    ),
                    const SizedBox(
                      width: 10.0,
                    ),
                    Expanded(
                      child: ElevatedButton(
                        onPressed: () {
                          int answer = int.parse(_answerController.text);
                          setState(() {
                            if (answer == _n1 + _n2) {
                              _remarks = "Correct!";
                            } else {
                              _remarks = "Wrong!";
                            }
                          });
                        },
                        child: const Text("Check"),
                      ),
                    ),
                  ],
                ),
                Text(
                  _remarks,
                  style: const TextStyle(fontSize: 40.0),
                ),
              ],
            ),
          ),
        ));
  }
}



UNITY: USING FIREBALL TO ELIMINATE ENEMIES

 Code user in the video: Fireball Controller using System . Collections ; using System . Collections . Generic ; using UnityEngine ; publ...