This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const ejs = require('ejs'); | |
const app = express(); | |
app.set('view engine', 'ejs'); | |
app.get('/', function(req,res){ | |
res.send("Hello World") | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE artists ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
birth_year INT, | |
country VARCHAR(255) | |
) engine=innoDB; | |
ALTER TABLE `artists` ADD `preferred_medium` VARCHAR(255) NULL AFTER `country`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Fictional Business</title> | |
</head> | |
<body> | |
<header id="main-header"> | |
<h1>Fictional Business</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. SETUP EXPRESS | |
const express = require('express'); | |
const hbs = require('hbs'); | |
const wax = require('wax-on'); | |
// 1a. create the app | |
const app = express(); | |
// 1b setup our view engine (aka template engine) | |
// tell Express that we are using hbs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"_id": "1001", | |
"name":"Tan Ah Kow", | |
"occupation":"Manager", | |
"students":[ | |
{ | |
"_id":"2002", | |
"name":"Benjamin Tan", | |
"dob":"2018-04-22", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> | |
<!-- leaflet css --> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"10009":[103.81722,1.2821,"Bt Merah Int"],"10011":[103.8375,1.27774,"Bef Neil Rd"],"10017":[103.83763,1.27832,"Aft Hosp Dr"],"10018":[103.8386,1.27901,"Outram Pk Stn Exit F/SGH"],"10021":[103.83839,1.27745,"Blk 3"],"10041":[103.83519,1.27606,"Bef Kampong Bahru Ter"],"10049":[103.83484,1.27623,"Opp Kampong Bahru Ter"],"10051":[103.83214,1.27741,"Blk 149"],"10059":[103.83275,1.2774,"Opp Blk 149"],"10061":[103.82949,1.2786,"Blk 140"],"10069":[103.83008,1.27855,"Opp Blk 140"],"10071":[103.82639,1.28045,"Blk 111"],"10079":[103.82709,1.2804,"Blk 201"],"10081":[103.82242,1.28228,"Opp Blk 120"],"10089":[103.82166,1.28292,"Blk 119"],"10091":[103.81784,1.28394,"Bt Merah Town Ctr"],"10099":[103.81766,1.28421,"Opp Bt Merah Town Ctr"],"10101":[103.81378,1.28506,"Opp Bt Merah Sec Sch"],"10109":[103.81371,1.28535,"Bt Merah Sec Sch"],"10111":[103.80935,1.28593,"Opp Blk 28"],"10119":[103.81123,1.28598,"Opp Pacific Tech Ctr"],"10121":[103.82891,1.2826,"Blk 126 CP"],"10129":[103.82857,1.28232,"Blk 121"],"10131":[103.80687,1.28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let radioButtons = document.querySelectorAll(".day"); | |
let selectedDay = ""; | |
for (let rb of radioButtons) { | |
if (rb.checked) { | |
selectedDay = rb.value; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require('mongodb') will return a Mongo object | |
// the Mongo client contains many other objects (aka properties) | |
// but we are only interested in the MongoClient | |
// hence put `.MongoClient` at the back of the require | |
const MongoClient = require('mongodb').MongoClient; | |
async function connect(mongoUri, dbName) { | |
const client = await MongoClient.connect(mongoUri, { | |
"useUnifiedTopology": true // there were different versions of Mongo | |
// when this is true we don't have to care about those versions |