Skip to content

Instantly share code, notes, and snippets.

@kunxin-chor
kunxin-chor / vue.config.js
Created September 25, 2020 06:08
Invalid host header for vue
// vue.config.js
module.exports = {
// options...
devServer: {
disableHostCheck: true
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="green">
@kunxin-chor
kunxin-chor / hdb.json
Last active February 9, 2023 07:32
JSON data files
[
{
"name":"Yishun",
"coordinates":[1.4304, 103.8354]
},
{
"name":"Bedok",
"coordinates":[1.3236, 103.9273]
},
{
ones = a % 10
tens = a // 10 % 10
temp = ones
ones = tens
tens = temp
print(tens, ones)
// SETUP
const express = require('express');
const hbs = require('hbs');
const wax = require('wax-on');
let app = express();
// set which view engine to use
app.set('view engine', 'hbs');
// set where to find the static files
const MongoClient = require("mongodb").MongoClient;
// global variable
let _db;
async function connect(url, dbname)
{
let client = await MongoClient.connect(url, {
useUnifiedTopology:true
});
@kunxin-chor
kunxin-chor / index.js
Last active February 25, 2022 08:26
Boilerplate Index.js
// EXPRESS AND OTHER SETUP
const express = require('express');
const MongoUtil = require('./MongoUtil.js')
const hbs = require('hbs')
const wax = require('wax-on')
// load in environment variables
require('dotenv').config();
// create the app
[
{
"_id":1,
"sku":"ACME-001",
"name":"ACME Chainsaw",
"price": 120.50,
"imageUrl": "https://www.stihlusa.com/WebContent/Images/Product/1550/ms251.png?preset=Product.ProductDetails"
},
{
"_id":2,
const express = require("express");
const hbs = require("hbs");
const wax = require("wax-on");
const mysql = require("mysql2/promise");
let app = express();
app.set("view engine", "hbs");
app.use(express.static("public"));
wax.on(hbs.handlebars);
wax.setLayoutPath("./views/layouts");
@kunxin-chor
kunxin-chor / index.js
Created June 25, 2021 02:47
Express Boilerplate
const express = require("express");
const hbs = require("hbs");
const wax = require("wax-on");
require("dotenv").config();
// create an instance of express app
let app = express();
// set the view engine
app.set("view engine", "hbs");