Skip to content

Instantly share code, notes, and snippets.

View hieptl's full-sized avatar
🎯
Focusing

Hiep Le hieptl

🎯
Focusing
View GitHub Profile
@hieptl
hieptl / index.html
Created September 13, 2022 10:32
Node.js Socket.io - index.html - 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chat app</title>
<!-- load Socket.io library -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.1/socket.io.js"
integrity="sha512-oFOCo2/3DtjrJG4N27BjSLQWoiBv171sK6a+JiWjp/7agxC2nCUP358AqzxkBUb5jX8g6CYLPdSKQTbC0weCwA=="
@hieptl
hieptl / server.js
Created September 13, 2022 10:31
Node.js Socket.io - server.js - 1
var http = require("http");
var fs = require("fs");
var path = require("path");
const APP_PORT = process.env.APP_PORT || 3000;
const app = http.createServer(requestHandler);
app.listen(APP_PORT);
console.log(`🖥 HTTP Server running at ${APP_PORT}`);
// handles all http requests to the server
@hieptl
hieptl / index.css
Created September 12, 2022 18:29
Chat App with Firebase - index.css
body {
background-color: #f3f2f3;
margin: 0;
padding: 0;
}
header {
text-align: center;
}
@hieptl
hieptl / index.js
Created September 12, 2022 18:28
Chat App with Firebase - index.js - 3
var firebaseConfig = {
apiKey: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
authDomain: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
databaseURL: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
projectId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
storageBucket: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
messagingSenderId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
appId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
};
@hieptl
hieptl / index.js
Created September 12, 2022 18:26
Chat App with Firebase - index.js - 2
var firebaseConfig = {
apiKey: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
authDomain: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
databaseURL: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
projectId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
storageBucket: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
messagingSenderId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
appId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
};
@hieptl
hieptl / index.js
Created September 12, 2022 18:24
Chat App with Firebase - index.js - 1
var firebaseConfig = {
apiKey: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
authDomain: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
databaseURL: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
projectId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
storageBucket: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
messagingSenderId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
appId: "xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx",
};
@hieptl
hieptl / index.html
Last active September 12, 2022 18:19
Chat App with Firebase - index.html - 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Firebase RealTime Chat</title>
<link rel="stylesheet" href="./index.css">
</head>
<body>
<header>
@hieptl
hieptl / index.html
Created September 12, 2022 18:18
Chat App with Firebase - index.html - 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Firebase RealTime Chat</title>
<link rel="stylesheet" href="./index.css">
</head>
<body>
@hieptl
hieptl / index.html
Created September 12, 2022 09:46
Javascript Chat App - index.html
<!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>Chat App with Vanilla JS</title>
<link rel="stylesheet" href="/css/styles.css" />
<script
defer
@hieptl
hieptl / login.html
Last active September 12, 2022 09:46
Javascript Chat App - login.html
<!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>Login</title>
<link rel="stylesheet" href="/css/styles.css" />
<script
defer