Skip to content

Commit

Permalink
Add video migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranahmedse committed Jan 2, 2023
1 parent 6216c30 commit 9e010f1
Show file tree
Hide file tree
Showing 42 changed files with 842 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/sync-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ echo "=== Migrating Guides ==="
node guide-migrator.cjs

echo "=== Migrating Videos ==="
# node video-migrator.cjs
node video-migrator.cjs
58 changes: 58 additions & 0 deletions bin/video-migrator.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const fs = require('fs');
const path = require('path');
const yaml = require('json-to-pretty-yaml');

const contentDirPath = path.join(__dirname, './developer-roadmap/content');
const videos = require('./developer-roadmap/content/videos.json');

// Remove the old videos directory
const newVideosDirPath = path.join(__dirname, '../src/videos');
if (fs.existsSync(newVideosDirPath)) {
fs.rmSync(newVideosDirPath, { recursive: true });
}

fs.mkdirSync(newVideosDirPath);

videos.forEach((video) => {
const { id: videoId } = video;

const originalVideoPath = path.join(
contentDirPath,
'videos',
`${videoId}.md`
);

const newVideoPath = path.join(__dirname, `../src/videos/${videoId}.md`);

const videoWithoutFrontmatter = fs.readFileSync(originalVideoPath, 'utf8');
fs.copyFileSync(originalVideoPath, newVideoPath);

const videoFrontMatter = yaml
.stringify({
title: video.title,
description: video.description,
duration: video.duration,
isNew: video.isNew,
date: video.createdAt.replace(/T.*/, ''),
author: {
name: 'Kamran Ahmed',
url: `https://twitter.com/kamranahmedse`,
imageUrl: `/authors/kamranahmedse.jpeg`,
},
sitemap: {
priority: 0.7,
changefreq: 'weekly',
},
tags: ['video', `video-sitemap`],
})
.replace(/date: "(.+?)"/, 'date: $1');

const videoWithIframeClass = videoWithoutFrontmatter
.replace(/<iframe/g, '<iframe class="w-full aspect-video mb-5"')
.replace(/<iframe(.+?)\s?\/>/g, '<iframe$1></iframe>');

const videoWithFrontmatter = `---\n${videoFrontMatter}---\n\n${videoWithIframeClass}`;

console.log(`Writing video ${videoId} to disk`);
fs.writeFileSync(newVideoPath, videoWithFrontmatter);
});
19 changes: 19 additions & 0 deletions src/videos/acid-explained.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "ACID Explained"
description: "Learn what it means for a database to be ACID compliant with examples."
duration: "5 minutes"
isNew: false
date: 2021-09-26
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/yaQ5YMWkxq4" title="Acid Explained with Examples"></iframe>
19 changes: 19 additions & 0 deletions src/videos/all-about-http-caching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "All about HTTP Caching"
description: "Learn what is HTTP caching, places for caching and different caching headers."
duration: "13 minutes"
isNew: false
date: 2020-10-04
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/HiBDZgTNpXY" title="All about HTTP Caching"></iframe>
19 changes: 19 additions & 0 deletions src/videos/array-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "All about Array Data Structure"
description: "Learn everything you need to know about array data structure"
duration: "10 minutes"
isNew: false
date: 2022-01-09
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/QJNwK2uJyGs" title="Array Data Structure"></iframe>
19 changes: 19 additions & 0 deletions src/videos/arrays-and-objects-in-javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Arrays and Objects in JavaScript"
description: "Learn how to manipulate arrays and objects in JavaScript."
duration: "12 minutes"
isNew: false
date: 2020-05-09
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/n3NKGsM3iEw" title="Arrays and Objects in JavaScript"></iframe>
19 changes: 19 additions & 0 deletions src/videos/async-javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Asynchronous JavaScript"
description: "Learn how to write asynchronous JavaScript using Async/Await"
duration: "15 minutes"
isNew: false
date: 2021-11-14
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/VyIK6SV5f7o" title="Asynchronous JavaScript"></iframe>
19 changes: 19 additions & 0 deletions src/videos/basic-authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Basic Authentication"
description: "Learn everything you need to know about basic authentication"
duration: "5 minutes"
isNew: true
date: 2022-10-01
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/mwccHwUn7Gc" title="Basic Authentication | Authentication Series"></iframe>
19 changes: 19 additions & 0 deletions src/videos/basics-of-authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Basics of Authentication"
description: "Learn everything you need to know about authentication with this Authentication Series"
duration: "5 minutes"
isNew: true
date: 2022-09-21
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/Mcyt9SrZT6g" title="Basics of Authentication"></iframe>
19 changes: 19 additions & 0 deletions src/videos/big-o-notation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Big O Notation"
description: "Learn what the Big-O notation is and how to calculate the time complexity of an algorithm."
duration: "8 minutes"
isNew: false
date: 2021-10-25
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/Z0bH0cMY0E8" title="Big O Notation — Calculating Time Complexity"></iframe>
19 changes: 19 additions & 0 deletions src/videos/content-delivery-networks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Content Delivery Networks"
description: "Learn what the CDNs are and the difference between push CDN vs pull CDN."
duration: "4 minutes"
isNew: false
date: 2020-09-26
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/6DXEPcXKQNY" title="Content Delivery Networks"></iframe>
19 changes: 19 additions & 0 deletions src/videos/dns-explained.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "DNS and how does it work?"
description: "Learn what the DNS is and how a website is found on the internet."
duration: "5 minutes"
isNew: false
date: 2020-08-17
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/Wj0od2ag5sk" title="DNS and how does it work?"></iframe>
19 changes: 19 additions & 0 deletions src/videos/dns-records.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "DNS Records"
description: "Learn what the DNS is and how a website is found on the internet."
duration: "6 minutes"
isNew: false
date: 2020-08-31
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/7lxgpKh_fRY" title="DNS Records"></iframe>
19 changes: 19 additions & 0 deletions src/videos/floating-point-arithmetic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Floating Point Arithmetic"
description: "Learn how ow the arithmetic operations work on floating-point numbers and why the results might be different from what you may expect."
duration: "4 minutes"
isNew: false
date: 2021-10-10
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/RIiq4tTt6rI" title="Floating Point Arithmetic"></iframe>
19 changes: 19 additions & 0 deletions src/videos/freeze-and-seal-objects-in-javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Freeze and Seal in JavaScript"
description: "Learn what is object freeze and seal in JavaScript and how to use them"
duration: "6 minutes"
isNew: false
date: 2020-10-16
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/O3uT2l6vgZ8" title="Freeze and Seal in JavaScript"></iframe>
19 changes: 19 additions & 0 deletions src/videos/graph-data-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Graph Data Structure"
description: "Learn everything you need to know about the graph data structure"
duration: "13 minutes"
isNew: false
date: 2022-09-08
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/0sQE8zKhad0" title="Graph Data Structure"></iframe>
19 changes: 19 additions & 0 deletions src/videos/hash-table-data-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Hash Table Data Structure"
description: "Learn everything you need to know about the hash table data structure"
duration: "8 minutes"
isNew: false
date: 2022-02-21
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/jalSiaIi8j4" title="Hash Table Data Structure"></iframe>
19 changes: 19 additions & 0 deletions src/videos/heap-data-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Heap Data Structure"
description: "Learn everything you need to know about the heap data structure"
duration: "11 minutes"
isNew: false
date: 2022-08-24
author:
name: "Kamran Ahmed"
url: "https://twitter.com/kamranahmedse"
imageUrl: "/authors/kamranahmedse.jpeg"
sitemap:
priority: 0.7
changefreq: "weekly"
tags:
- "video"
- "video-sitemap"
---

<iframe class="w-full aspect-video mb-5" src="https://www.youtube.com/embed/F_r0sJ1RqWk" title="Heap Data Structure"></iframe>
Loading

0 comments on commit 9e010f1

Please sign in to comment.