Skip to content

Instantly share code, notes, and snippets.

@kunxin-chor
kunxin-chor / outline.txt
Created April 23, 2025 06:46
Outline for Lecture
Title: Engaging Students with Technology
1. Problem: There are too many distractions in class. Students are often distracted
2. Engagement is key. Make the lesson interactive
3. Another problem: However engagement can be difficult because
- students can be shy
- engagement takes up lesson time
4. We can use technology to boost engagement
5. Padlet: group discussion and sharing
6. Slido: Polls and Q&A
@kunxin-chor
kunxin-chor / gist:00305c0bf16e682e0bc5cbd3966653bf
Created September 13, 2024 01:30
Thymeleaf template inheritance
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{base :: html(
~{::title},
~{::content},
~{},
~{}
)}">
@kunxin-chor
kunxin-chor / Main.java
Created September 5, 2024 11:29
Main.java template
public class Main {
public static void main() {
while (true) {
displayMenu();
int choice = getMenuChoice();
boolean keepRunning = processChoice(choice);
if (keepRunning == false) {
break;
}
@kunxin-chor
kunxin-chor / script.js
Created August 17, 2024 04:36
Create a leaflet map
// DOMContentLoaded event is executed when the DOM is ready
// (i.e all the HTML elements have been created), so it's
// a good starting point to run any code
document.addEventListener("DOMContentLoaded", async function(){
// the first argument of L.map is the ID
// where the map will be rendered (i.e drawn)
const map = L.map('map');
// two parameters for setView
// 1st: lat lng of the center of the map
// Tradable interface
interface Tradable {
double getCurrentMarketPrice();
void executeTransaction(boolean isBuy, int quantity);
}
// Insurable interface
interface Insurable {
double calculatePremium();
void fileClaim(String claimDescription);
@kunxin-chor
kunxin-chor / index.js
Created March 11, 2024 02:33
RESTFul API Template
// 1. REQUIRE DEPENDENCIES
const express = require('express');
const mongodb = require('mongodb');
const cors = require('cors');
const app = express();
// enable the use of JSON
app.use(express.json());
@kunxin-chor
kunxin-chor / pet_hospital.mysql
Created September 24, 2023 08:14
MySQL Database for Pet Hospital
-- Check if the database exists, if not, create it
CREATE DATABASE IF NOT EXISTS pet_hospital;
USE pet_hospital;
-- Create the `pets` table
CREATE TABLE IF NOT EXISTS pets (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
species VARCHAR(255) NOT NULL,
breed VARCHAR(255) DEFAULT NULL,
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Book List</title>
<!-- include Bootstrap 5 CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
</head>
<body>
<!-- A sample application that demonstrates the major features of ES6, ES7, ES8, ES9, and ES10
@kunxin-chor
kunxin-chor / index.html
Last active June 20, 2023 09:24
ATM DOM
<!DOCTYPE html>
<html>
<head>
<title>ATM Machine</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="atm">
<div id="display">Insert card to begin</div>
@kunxin-chor
kunxin-chor / db.sql
Last active June 20, 2023 04:59
Pet Hospital Example
CREATE TABLE roles (
role_id INT AUTO_INCREMENT PRIMARY KEY,
role_name VARCHAR(255) NOT NULL
);
CREATE TABLE users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
first_name VARCHAR(255) NOT NULL,