Skip to content

Instantly share code, notes, and snippets.

@1travelintexan
1travelintexan / Express Basic Site
Created March 10, 2022 10:21
Site about 'The Rock'
//App.js file ///////////////////////////////////////////////////////
const express = require('express')
const app = express()
const port = 3000
app.use("/public", express.static(__dirname + "/public"));
// app.use("/public", express.static(__dirname + "/public"));
app.get('/', (req, res) => {
unction Profile({ currentUser, setUser }: IProps) {
const navigate = useNavigate();
function handleUserImage(event: any) {
event.preventDefault();
let image = event.target.imageUrl.files[0];
let imageFormData = new FormData();
imageFormData.append("imageUrl", image);
async function sendImage() {
const canvas = document.querySelector("canvas");
canvas.style.border = "2px solid black";
const ctx = canvas.getContext("2d");
const startScreen = document.querySelector(".game-intro");
//adding some cool song
const song = new Audio("../Eye_of_the_Tiger.mp3");
song.volume = 0.1;
//variables
@1travelintexan
1travelintexan / app.js
Created October 26, 2022 08:08
Ironbeers Lab EJS
const express = require('express');
const expressLayouts = require('express-ejs-layouts');
const path = require('path');
const PunkAPIWrapper = require('punkapi-javascript-wrapper');
const app = express();
const punkAPI = new PunkAPIWrapper();
app.set('view engine', 'ejs');
//Make sure to require your model so you can connect to the DB
//<========Model of viking to connect the backend to the DB
const { default: mongoose } = require("mongoose");
const VikingModel = require("./models/User");
//This line of code connects to the Database
require("./db");
//Iteration 2:
//create a user as an object
const Ragnar = {
<div id="main-ctn">
<h1 class="display-artist-name">
Albums for:
</h1>
<div id="main-grid">
<% albumsArr.forEach(album=> { %>
<div class="item">
<div class="item-img-ctn">
class Queue {
constructor() {
this.queueControl = [];
this.MAX_SIZE = 10;
}
canEnqueue() {
if (this.queueControl.length === this.MAX_SIZE) {
return false;
} else {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Apple Pie Recipe</title>
<!-- Remember to link your styles -->
<link rel="stylesheet" href="styles/style.css"
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- link the Font Awesome stylesheet - CDN -->
<link
href="https://use.fontawesome.com/releases/v5.0.1/css/all.css"
@1travelintexan
1travelintexan / index.js
Created March 30, 2023 08:48
Basic Algorithms Lab
// Iteration 1: Names and Input
let hacker1 = "Joshua"
console.log(`The driver's name is ${hacker1}`);
let hacker2 = "Josh"
console.log(`The navigator's name is ${hacker2}`);
// Iteration 2: Conditionals