Skip to content

Commit 3c04c8c

Browse files
authored
Merge pull request #16 from CourseKrimson/enhancement
Create new course diversion (#15)
2 parents 713ea1f + 90c7a8e commit 3c04c8c

File tree

5 files changed

+101
-603
lines changed

5 files changed

+101
-603
lines changed

coursemaker.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
3+
def delete_course_files(start, end, directory):
4+
# Iterate through the range of course numbers
5+
for i in range(start, end + 1):
6+
# Construct the filename
7+
filename = f'course{i}.md'
8+
# Create the full path to the file
9+
file_path = os.path.join(directory, filename)
10+
11+
# Check if the file exists and delete it
12+
if os.path.isfile(file_path):
13+
os.remove(file_path)
14+
print(f'Deleted: {file_path}')
15+
else:
16+
print(f'File not found: {file_path}')
17+
18+
# Directory where the course files are located
19+
directory = 'public/courses/'
20+
21+
# Specify the range of course numbers to delete
22+
delete_course_files(3, 33, directory)

public/courses/course1.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This course covers:
2+
- Installing and configuring OH MY ZSH
3+
- Customizing ZSH themes and plugins
4+
- Productivity tips for terminal users
5+
6+
## Requirements
7+
- Familiar with Bash, Terminal & Commands
8+
9+
### What is Zsh?
10+
<q>Zsh or Zshell is an enhanced, improved, and extended version of BASH (Bourne Again Shell).</q>
11+
12+
### Why Oh My Zsh?
13+
<code>Oh My Zsh</code> is an open-source framework used to customize zsh as well as manage its configs.
14+
15+
## Steps Performed:
16+
---
17+
18+
### ZSH Installation
19+
Installation may differ according to your OS. [See here](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
20+
21+
**For Ubuntu**: <code>$ sudo apt install zsh</code>
22+
23+
### Oh-My-Zsh Installation
24+
Install **Oh-My-Zsh** according to your OS or distro. [See here](https://ohmyz.sh/#install)
25+
26+
**For Ubuntu**: <code>$ sh -c $(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)</code>
27+
28+
### Zsh Configuration
29+
![Screenshot of Oh-My-Zsh](https://uploads.sitepoint.com/wp-content/uploads/2019/11/1573134240zsh-02.png)
30+
31+
Boom! Now, your .zshrc <i>(source file for zshell launch)</i> has been replaced by a new .zshrc file <i>(in your home dir or where you've installed it)</i>. The original .zshrc is kept as a backup file.
32+
33+
#### Themes
34+
The first thing I'd ever do is to change my terminal theme as I like. So, let's explore what will suit us?
35+
**Editing <q>.zshrc</q> file**
36+
Go to <code>~</code> <i>(home dir or where you've installed it)</i>
37+
I performed: <code>$ cd ~</code>
38+
Choose your favorite editor and edit the **.zshrc** file.
39+
I performed: <code>$ nano .zshrc</code>
40+
To change the theme you need to change the value of <q>ZSH_THEME</q>.
41+
For exploring themes, I placed <q>random</q>. So that, it will launch with any random theme at every instance.
42+
If you've chosen one, just edit ~/.zshrc file and change the value of <q>ZSH_THEME</q> with the theme you want.
43+
I changed <code>ZSH_THEME="devcontainers"</code> to <code>ZSH_THEME="fino"</code>.
44+
45+
#### Auto-Suggestions
46+
This plugin suggests commands based on your past history, saving you both effort and time.
47+
**Installing <q>Auto-Suggestions</q> plugin**
48+
Clone GitHub repository to install it: <code>git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions</code>.
49+
After installing, again edit your **.zshrc** file and look for <q>plugins</q> config, and change <code># plugins=(git)</code> to <code>plugins=(git zsh-autosuggestions)</code>.
50+
51+
IMPORTANT: <i>See changes done by using zsh to launch again with new config(s).</i>
52+
53+
**Thank You! Jay Nepal!**

public/courses/course2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
A <code>command line interface (CLI)</code> is a text-based user interface used to interact with a computer system.
2+
It uses commands to perform tasks, such as creating files or installing programs.
3+
CLIs are useful for automation and troubleshooting, and they can be more efficient than graphical user interfaces (GUIs) for certain tasks.
4+
They were commonly used in the past with systems like Unix, MS-DOS, and Apple DOS, and are still used today by software developers and system administrators.
5+

src/components/CourseDetail.jsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
import React from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import { useParams } from 'react-router-dom';
33
import courses from './courseData';
4-
import YouTubeEmbed from './YouTubeEmbed';
54
import { marked } from 'marked';
5+
import YouTubeEmbed from './YouTubeEmbed'
66

77
function CourseDetail() {
88
const { courseName } = useParams();
99
const courseKey = courseName.toLowerCase();
1010
const course = courses[courseKey];
1111

12+
const [content, setContent] = useState('');
13+
1214
if (!course) {
1315
return <h2 className="text-center">Course not found</h2>;
1416
}
1517

16-
const renderMarkdown = (markdownText) => {
17-
return { __html: marked(markdownText) };
18-
};
18+
useEffect(() => {
19+
fetch(course.contentFile)
20+
.then(response => response.text())
21+
.then(text => setContent(marked(text)))
22+
.catch(error => console.error('Error fetching the markdown file:', error));
23+
}, [course.contentFile]);
1924

2025
return (
21-
<div className="container mt-5">
22-
<h2 className='text-center'>{course.title}</h2>
23-
{/* <img src={course.image} alt={course.title} className="img-fluid" /> */}
24-
<p className='text-center'>{course.description}</p>
25-
<h4 className='text-center'>Course Content:</h4>
26-
<YouTubeEmbed videoId={course.ytb_vid} />
27-
<div dangerouslySetInnerHTML={renderMarkdown(course.content)} />
28-
29-
<h6><span className="badge bg-primary"><i className="fa-solid fa-pen-nib"></i> {course.author}</span></h6>
26+
<div className='container mt-5'>
27+
<h1>{course.title}</h1>
28+
<YouTubeEmbed videoId={course.ytb_vid} ></YouTubeEmbed>
29+
<p>{course.description}</p>
30+
<div dangerouslySetInnerHTML={{ __html: content }} />
3031
</div>
3132
);
3233
}

0 commit comments

Comments
 (0)