Skip to content

Instantly share code, notes, and snippets.

View isaacg11's full-sized avatar
πŸ‘¨β€πŸ’»
coding

Isaac Grey isaacg11

πŸ‘¨β€πŸ’»
coding
View GitHub Profile
const mongoose = require("mongoose");
const dbUrl =
"mongodb+srv://test:test123@test-db.qxz3ruo.mongodb.net/?retryWrites=true&w=majority&appName=test-db";
mongoose
.connect(dbUrl)
.then(() => console.log("Successful connection to database"))
.catch((err) => console.error("Error: " + err));
// 1. Initializing Quiz Parameters
var currentQuestion = 0;
var score = 0;
var numOfQuestions = questions.length;
var numOfChoices = 3;
var questionCountElement = document.getElementById("question-count");
// 2. Displaying the Current Question
function displayQuestion() {
var questionElement = document.getElementById("question");
// Function to load content on the index.html page
function loadContent() {
const userLogin = sessionStorage.getItem("login");
if (userLogin) {
fetchAndLoadData();
} else {
window.location.href = "../html/signin.html";
}
}
import React, { useState } from "react";
import { users } from "../users";
const LoginPage = () => {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
function login() {
const user = users.find((u) => u.username === username);
if (user) {
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="movies.js"></script>
</head>
<body id="main">
<h1>Movie Database</h1>
<input type="text" id="search" placeholder="Search for a movie">
<div id="movie-list">
// Get references to HTML elements
const movieList = document.getElementById('movie-list');
const searchInput = document.getElementById('search');
const movieDetailsContainer = document.getElementById('main');
// Attach an input event listener for the search input
searchInput.addEventListener('input', handleSearchInput);
// Initialize movie data and display all movies
let movieData = movies; // Assuming you have a `movies` array
require('dotenv').config();
const express = require('express');
const session = require("express-session");
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const passport = require('passport');
const mongoose = require('mongoose');
const app = express();
const Rollbar = require("rollbar");
This file has been truncated, but you can view the full file.
{
"name": "react-gh-pages",
"version": "0.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "react-gh-pages",
"version": "0.1.0",
"dependencies": {
import React from "react";
import {
getFlagEmoji,
decodeHtmlEntities,
formatCountryName,
formatNumberWithCommas,
} from "./helperFunctions";
const TableBody = ({ data, visibilityfilter }) => {
const uniqueKey = visibilityfilter === "continents" ? "continent" : "country";
import React, { useState, useEffect } from "react";
import "./Table.css";
import { filterData, sortedData } from "./dataProcessing";
import TableBody from "./TableBody";
import TableHeader from "./TableHeader";
import ControlPanel from "./ControlPanel";
const Table = ({ covidStats }) => {
const [showClearButton, setShowClearButton] = useState(false);
const [visibilityfilter, setvisibilityfilter] = useState(