Skip to content

Commit 036c707

Browse files
committed
Too many changes
1 parent adaee79 commit 036c707

File tree

17 files changed

+585
-369
lines changed

17 files changed

+585
-369
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
*.class
2-
<<<<<<< HEAD
32
.vscode
4-
=======
5-
*.jpg
6-
>>>>>>> 614b361628efd057638a2520ae5614af0d724f2e

AddTerm.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ public static void main(String[] args) {
99
return;
1010
}
1111

12-
String termName = args[0].replace(" ", "_").trim(); // Format term name
13-
String firstLetter = termName.substring(0, 1).toLowerCase(); // Get first letter
12+
String originalTerm = args[0].trim(); // Keep original term for JSON
13+
String formattedTerm = originalTerm.replace(" ", "_"); // Format term for file name
14+
String firstLetter = formattedTerm.substring(0, 1).toLowerCase(); // Get first letter
1415
String termsDirectory = "terms/" + firstLetter + "/"; // Directory path
1516
String jsonFilePath = termsDirectory + "terms.json"; // JSON file path
1617

@@ -42,11 +43,11 @@ public static void main(String[] args) {
4243
}
4344

4445
// Add new term to the set if not already present
45-
termsSet.add(termName); // Set automatically handles duplicates
46+
termsSet.add(originalTerm); // Store original term in JSON for display purposes
4647

4748
// Convert Set to a sorted list
4849
List<String> termsList = new ArrayList<>(termsSet);
49-
Collections.sort(termsList); // Sort for consistency
50+
Collections.sort(termsList, String.CASE_INSENSITIVE_ORDER); // Sort for consistency, case-insensitive
5051

5152
// Write updated terms to JSON file
5253
try (BufferedWriter jsonWriter = new BufferedWriter(new FileWriter(jsonFilePath))) {

AddTerm.sh

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,88 @@ create_default_html() {
1111
<meta charset="UTF-8">
1212
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1313
<title>$term</title>
14+
<style>
15+
body {
16+
background-color: #0a0e17;
17+
color: #e8eaed;
18+
font-family: 'Courier New', monospace;
19+
margin: 0;
20+
min-height: 100vh;
21+
background: linear-gradient(135deg, #0a0e17 0%, #1a1f35 100%);
22+
background-attachment: fixed;
23+
position: relative;
24+
}
25+
26+
body::before {
27+
content: "";
28+
position: fixed;
29+
top: 0;
30+
left: 0;
31+
width: 100%;
32+
height: 100%;
33+
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%232e5bad' fill-opacity='0.05'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
34+
opacity: 0.8;
35+
z-index: -1;
36+
}
37+
38+
.term-content {
39+
font-family: 'Courier New', monospace;
40+
max-width: 800px;
41+
margin: 80px auto 30px;
42+
padding: 30px;
43+
background: rgba(10, 14, 23, 0.8);
44+
border-radius: 8px;
45+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 191, 255, 0.1);
46+
border: 1px solid rgba(0, 191, 255, 0.2);
47+
line-height: 1.6;
48+
}
49+
50+
.term-content h1 {
51+
color: #00bfff;
52+
border-bottom: 1px solid rgba(0, 191, 255, 0.3);
53+
padding-bottom: 10px;
54+
text-shadow: 0 0 10px rgba(0, 191, 255, 0.3);
55+
font-size: 28px;
56+
}
57+
58+
.term-content p {
59+
color: #e8eaed;
60+
text-align: justify;
61+
}
62+
63+
.term-content code {
64+
background: rgba(0, 0, 0, 0.3);
65+
padding: 2px 5px;
66+
border-radius: 3px;
67+
color: #00bfff;
68+
font-family: 'Courier New', monospace;
69+
border: 1px solid rgba(0, 191, 255, 0.2);
70+
}
71+
72+
@media (max-width: 768px) {
73+
.term-content {
74+
padding: 20px;
75+
margin: 70px auto 20px;
76+
}
77+
}
78+
79+
@media (max-width: 480px) {
80+
.term-content {
81+
padding: 15px;
82+
margin: 60px auto 15px;
83+
}
84+
85+
.term-content h1 {
86+
font-size: 24px;
87+
}
88+
}
89+
</style>
1490
</head>
1591
<body>
16-
<h1>$term</h1>
17-
<p>Description of $term goes here.</p>
92+
<div class="term-content">
93+
<h1>$term</h1>
94+
<p>Description of $term goes here.</p>
95+
</div>
1896
</body>
1997
</html>
2098
EOF
@@ -29,7 +107,8 @@ java AddTerm "$term"
29107
# Determine directory and file path
30108
first_letter=$(echo "${term:0:1}" | tr '[:upper:]' '[:lower:]')
31109
terms_directory="terms/$first_letter/"
32-
html_file_path="${terms_directory}${term}.html"
110+
formatted_term=$(echo "$term" | sed 's/ /_/g')
111+
html_file_path="${terms_directory}${formatted_term}.html"
33112

34113
# Create directory if it doesn't exist
35114
mkdir -p "$terms_directory"

README.md

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,60 @@
22

33
Nersh is a search engine designed for programmers and tech enthusiasts. It allows users to search for programming-related terms and view detailed definitions and explanations. The project is structured in a way that contributors can easily add new terms and corresponding HTML files, all while maintaining an organized and accessible search functionality.
44

5-
## Features💫
6-
- **Dynamic Search Suggestions**: As users type in the search box, suggestions are displayed based on matching terms.
7-
- **Pre-generated HTML for Terms**: Each term has its own pre-generated HTML page, following a template.
8-
- **JSON-based Term Storage**: Terms are stored in a JSON file for easy retrieval and dynamic search functionality.
9-
- **Nerdy Button**: An "I'm Feeling Nerdy" button that takes users to a random tech-related term.
5+
## Features 💫
6+
- **Dark Theme UI**: Modern dark gradient interface with geometric pattern overlay for a true nerdy experience
7+
- **Dynamic Search**: Real-time suggestions as users type with enhanced error handling
8+
- **Responsive Design**: Optimized for both desktop and mobile devices
9+
- **Pre-generated HTML for Terms**: Each term has its own styled HTML page with consistent theming
10+
- **JSON-based Term Storage**: Terms are stored in JSON files for easy retrieval and search functionality
11+
- **"I'm Feeling Nerdy" Button**: Takes users to a random tech-related term
1012

1113
## Project Structure
1214
```
1315
/terms
1416
/a
15-
- Algorithms.html
16-
- API.html
17-
- Asynchronous_Programming.html
18-
- terms.json
17+
- a_term.html
1918
/b
20-
- Binary_Search.html
21-
- terms.json
22-
/styles.css
19+
- b_term.html
20+
/styles
21+
- styles.css
22+
/scripts
23+
- script.js
2324
/index.html
24-
/script.js
25+
/AddTerm.sh
26+
/AddTerm.java
2527
```
26-
- **/terms**: Contains directories for each letter of the alphabet. Each directory stores the HTML pages for terms starting with that letter as well as a `terms.json` file that lists all terms.
27-
- **/styles.css**: The main CSS file for styling the entire project.
28-
- **/index.html**: The homepage with the search functionality.
29-
- **/script.js**: Contains JavaScript for dynamic search suggestions and term navigation.
30-
- **/addterm.sh**: A shell script to automate the process of adding new terms and creating HTML files.
31-
- **/AddTerm.java**: A Java program to update the JSON file with new terms.
28+
- **/terms**: Contains directories for each letter of the alphabet with HTML pages and JSON files
29+
- **/styles/styles.css**: The main CSS file for styling the entire project
30+
- **/scripts/script.js**: Contains JavaScript for search functionality and term navigation
31+
- **/index.html**: The homepage with the search functionality
32+
- **/AddTerm.sh**: A shell script to automate the process of adding new terms with built-in styling
33+
- **/AddTerm.java**: A Java program to update the JSON file with new terms
3234

3335
---
3436

3537
## How to Add New Terms
3638

37-
To add a new term to the search engine, you can use the provided **shell script** (`addterm.sh`) or the **Java program** (`AddTerm.java`). Both tools automate the process of adding terms and creating the required HTML files.
39+
To add a new term to the search engine, you can use the provided **shell script** (`AddTerm.sh`) or the **Java program** (`AddTerm.java`). Both tools automate the process of adding terms and creating the required HTML files.
3840

39-
### **Using the Shell Script (`addterm.sh`)**
40-
The shell script provides an interactive way to add new terms and create HTML files. It also allows you to edit the HTML file using your preferred text editor.
41+
### **Using the Shell Script (`AddTerm.sh`)**
42+
The shell script provides an interactive way to add new terms and create HTML files with built-in styling. It also allows you to edit the HTML file using your preferred text editor.
4143

4244
#### Steps:
4345
1. Run the script:
4446
```bash
45-
bash addterm.sh
46-
47-
~Enter the term name when prompted.
48-
49-
Choose whether to edit the HTML file using nano, vim, or skip editing.
50-
The script will:
51-
- Create the HTML file in the appropriate directory.
52-
- Update the terms.json file with the new term.
53-
- Optionally commit the changes to Git.
47+
bash AddTerm.sh
48+
```
49+
2. Enter the term name when prompted.
50+
3. Choose whether to edit the HTML file using nano, vim, or skip editing.
51+
4. The script will:
52+
- Create a styled HTML file in the appropriate directory
53+
- Update the terms.json file with the new term
54+
- Optionally commit the changes to Git
5455

5556
Example:
5657
```
57-
$ bash addterm.sh
58+
$ bash AddTerm.sh
5859
Enter the term: Machine Learning
5960
New term added successfully to JSON!
6061
Do you want to edit the HTML file? (nano/vim/none): nano
@@ -63,41 +64,53 @@ Do you want to commit the new term added? (yes/no): yes
6364
Changes committed.
6465
Done!
6566
```
66-
## Using the Java Program `(AddTerm.java)`
67+
68+
### **Using the Java Program (`AddTerm.java`)**
6769

6870
The Java program updates the JSON file with new terms, ensuring no duplicates and maintaining alphabetical order.
69-
Steps:
7071

71-
1. Compile the Java program:
72-
```
73-
javac AddTerm.java
72+
#### Steps:
73+
1. Compile the Java program:
74+
```
75+
javac AddTerm.java
7476
```
7577

76-
2. Run the program with the term name as an argument:
77-
```
78-
java AddTerm <TERM_NAME>
79-
```
80-
3. The program will:
81-
Update the `terms.json` file in the appropriate directory.
82-
Print a success message if the term is added.
83-
84-
Example:
85-
```
86-
$ java AddTerm "Artificial Intelligence"
87-
New term added successfully to JSON!
78+
2. Run the program with the term name as an argument:
79+
```
80+
java AddTerm <TERM_NAME>
8881
```
82+
83+
3. The program will:
84+
- Update the `terms.json` file in the appropriate directory
85+
- Print a success message if the term is added
86+
87+
Example:
88+
```
89+
$ java AddTerm "Artificial Intelligence"
90+
New term added successfully to JSON!
91+
```
92+
93+
## Search Functionality
94+
95+
The search function provides real-time suggestions as you type:
96+
1. Enter a term in the search box
97+
2. Select from the dropdown of suggestions or press Enter
98+
3. If the term exists, you'll be redirected to the term's page
99+
4. Use the "I'm Feeling Nerdy" button to discover random tech terms
100+
89101
## How to Contribute
90-
Fork this repository.
91-
Clone your forked repository to your local machine.
92-
Create a new branch for your feature or bug fix.
93-
Implement your changes and commit them to your branch.
94-
Push your changes to your forked repository.
95-
Create a pull request to the main repository.
96-
97-
## Contribution Guidelines:
98-
Follow the existing structure and style conventions in both HTML and CSS.
99-
Ensure that all terms added to the JSON file are unique and properly formatted.
100-
101-
Use the provided tools (`addterm.sh` or `AddTerm.java`) to add new terms.
102+
1. Fork this repository
103+
2. Clone your forked repository to your local machine
104+
3. Create a new branch for your feature or bug fix
105+
4. Implement your changes and commit them to your branch
106+
5. Push your changes to your forked repository
107+
6. Create a pull request to the main repository
108+
109+
### Contribution Guidelines:
110+
- Follow the existing structure and style conventions
111+
- Ensure that all terms added to the JSON file are unique and properly formatted
112+
- Use the provided tools (`AddTerm.sh` or `AddTerm.java`) to add new terms
113+
- Test your changes locally before submitting a pull request
114+
102115
## License
103116
This project is open-source under the MIT License.

commit.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
read -p "Do you want to commit the new term added? (yes/no): " commit_choice
33

44
if [[ "$commit_choice" == "yes" ]]; then
5-
# Request for term name again
6-
read -p "Enter term again: " term
5+
# Use the term from AddTerm.sh if available
6+
if [[ -z "$term" ]]; then
7+
# If term is not available (script run directly), ask for it
8+
read -p "Enter term: " term
9+
fi
10+
711
# Stage all changes
812
git add .
913

index.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>nerdsRanch</title>
7-
<link rel="stylesheet" href="styles.css">
7+
<link rel="stylesheet" href="styles/styles.css">
88
</head>
99
<body>
1010

1111
<header>
12-
<div class="logo">nerdsRanch</div>
13-
<div class="others">
14-
<div class="home-b">Home</div>
15-
<div class="about-b">About Us</div>
16-
</div>
12+
<div class="logo">Nersh</div>
1713
</header>
1814

1915
<div class="container">
@@ -22,12 +18,12 @@
2218
<form action="#">
2319
<input type="text" id="search-box" class="search-box" placeholder="Yeah type here..." autocomplete="off" oninput="showSuggestions()">
2420
<ul id="suggestions-list" class="suggestions-list"></ul>
25-
<!-- <button type="submit" class="search-button">nersh-it</button> -->
21+
<button type="button" id="nerdy-button" class="nerdy-button">I'm Feeling Nerdy</button>
2622
</form>
2723
</div>
2824
</div>
2925
</div>
3026

31-
<script src="script.js"></script>
27+
<script src="scripts/script.js"></script>
3228
</body>
3329
</html>

0 commit comments

Comments
 (0)