Skip to content

Commit 7b36cc5

Browse files
author
Arif Luthfi
committed
New Stuff
1 parent bb51c0f commit 7b36cc5

File tree

19 files changed

+2276
-0
lines changed

19 files changed

+2276
-0
lines changed

006 - Websocket/public/index.html

295 Bytes
Binary file not shown.

019 - Kafka Basic/package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "019_kafka_basic",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"kafkajs": "^1.12.0"
13+
}
14+
}

019 - Kafka Basic/topic.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const {Kafka} = require("kafkajs")
2+
3+
run();
4+
async function run(){
5+
try{
6+
const kafka = new Kafka({
7+
clientId : "myapp",
8+
brokers : [
9+
"localhost:9092"
10+
]
11+
});
12+
13+
// Establish admin instance
14+
const admin = kafka.admin();
15+
16+
// Connect to kafka server
17+
console.log("Connecting . . .");
18+
await admin.connect();
19+
console.log("Connected!");
20+
21+
// Create topics
22+
await admin.createTopics({
23+
topics : [{
24+
topic : "Users",
25+
numPartitions : 2,
26+
}]
27+
})
28+
29+
console.log("Topic created successfully!");
30+
await admin.disconnect();
31+
32+
33+
}catch(err){
34+
console.error(`Something bad happen ${err}`)
35+
}finally{
36+
process.exit();
37+
}
38+
}

019 - Kafka Basic/yarn.lock

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
kafkajs@^1.12.0:
6+
version "1.12.0"
7+
resolved "https://registry.yarnpkg.com/kafkajs/-/kafkajs-1.12.0.tgz#50ad336baee95f3324af8ae8df6fadc96e07c613"
8+
integrity sha512-Izkd9iFRgeeKaHEgVpGQH08ygzCbHSxTbnu8W3G3uiNaVjGibUTmTwjv1Qf2M8NORXcPfzwVyg6bBlVj4SKr9g==
9+
dependencies:
10+
long "^4.0.0"
11+
12+
long@^4.0.0:
13+
version "4.0.0"
14+
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
15+
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==

020 - EditorJS/css/main.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* No CSS *//*# sourceMappingURL=main.css.map */

020 - EditorJS/css/main.css.map

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

020 - EditorJS/css/main.scss

Whitespace-only changes.

020 - EditorJS/index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="/css/main.css">
8+
</head>
9+
<body>
10+
<h1>Your content</h1>
11+
<div id="editorjs"></div>
12+
<button>Save Article</button>
13+
</body>
14+
<script src="./index.js"></script>
15+
</html>

020 - EditorJS/index.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import EditorJS from '@editorjs/editorjs';
2+
import Header from "@editorjs/header"
3+
import List from "@editorjs/list"
4+
import Embed from "@editorjs/editorjs"
5+
6+
const editor = new EditorJS({
7+
holder : "editorjs",
8+
tools : {
9+
header : {
10+
class : Header,
11+
inlineToolbar : ['link']
12+
},
13+
list : {
14+
class : List,
15+
inlineToolbar : [
16+
'link',
17+
'bold'
18+
]
19+
},
20+
21+
}
22+
})
23+
24+
let saveBtn = document.querySelector("button");

020 - EditorJS/package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "020_editorjs",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"@editorjs/editorjs": "^2.18.0",
13+
"@editorjs/header": "^2.5.0",
14+
"@editorjs/list": "^1.5.0"
15+
}
16+
}

020 - EditorJS/yarn.lock

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
"@editorjs/editorjs@^2.18.0":
6+
version "2.18.0"
7+
resolved "https://registry.yarnpkg.com/@editorjs/editorjs/-/editorjs-2.18.0.tgz#bde42183013f5ca98693e77986cc9d8b2c9a1244"
8+
integrity sha512-9OKs580JFKoXCAw7llb19E+qxY6QuzgDBq50cKbyOS1Lt+BglTq/zBdXxmRWNRTlCMxjTB1vgnq70+OjEyDSlw==
9+
dependencies:
10+
codex-notifier "^1.1.2"
11+
codex-tooltip "^1.0.1"
12+
13+
"@editorjs/header@^2.5.0":
14+
version "2.5.0"
15+
resolved "https://registry.yarnpkg.com/@editorjs/header/-/header-2.5.0.tgz#f6266d5b7e639fc38289291160f9c41ab12d9da5"
16+
integrity sha512-7j8g5/pjb7WtzjpANai/BoUK4QnZdNLt6Q4YRWL8xfLfUtN2M6zEfV11TuEh/l6eZlO0f/5vkXDFXDsbfeJfDA==
17+
18+
"@editorjs/list@^1.5.0":
19+
version "1.5.0"
20+
resolved "https://registry.yarnpkg.com/@editorjs/list/-/list-1.5.0.tgz#8675c82caa25f50744a4b072a7911163ce26bd74"
21+
integrity sha512-LzZuJwJ2HxCkuaPrp3zYdQGvMC8dzXjewqWEBZ9mpq0fVwBAse4o9QB2mWvJxZ93UtLqQE7f9vrbHotG2uW9Qg==
22+
23+
codex-notifier@^1.1.2:
24+
version "1.1.2"
25+
resolved "https://registry.yarnpkg.com/codex-notifier/-/codex-notifier-1.1.2.tgz#a733079185f4c927fa296f1d71eb8753fe080895"
26+
integrity sha512-DCp6xe/LGueJ1N5sXEwcBc3r3PyVkEEDNWCVigfvywAkeXcZMk9K41a31tkEFBW0Ptlwji6/JlAb49E3Yrxbtg==
27+
28+
codex-tooltip@^1.0.1:
29+
version "1.0.1"
30+
resolved "https://registry.yarnpkg.com/codex-tooltip/-/codex-tooltip-1.0.1.tgz#f6e4f39d81507f9c455b667f1287746d14ee8056"
31+
integrity sha512-1xLb1NZbxguNtf02xBRhDphq/EXvMMeEbY0ievjQTHqf8UjXsD41evGk9rqcbjpl+JOjNgtwnp1OaU/X/h6fhQ==

022 - KoaJS/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const koa = require("koa")
2+
const path = require("path")
3+
const render = require("koa-ejs")
4+
const koaRouter = require("koa-router")
5+
const axios = require("axios")
6+
7+
const app = new koa();
8+
const router = new koaRouter();
9+
10+
render (app, {
11+
root: path.join(__dirname, "views"),
12+
layout: "index",
13+
viewExt: "html",
14+
});
15+
16+
17+
18+
19+
20+
app.listen(3000);

0 commit comments

Comments
 (0)