From e1823853e4e01c6d25b6682fc9f4ee9b03016307 Mon Sep 17 00:00:00 2001 From: james-beans Date: Sun, 29 Dec 2024 21:17:38 +0000 Subject: [PATCH 1/8] added helloworld to cpp, javascript, python and rust --- public/data/cpp.json | 19 +++++++++++++++++++ public/data/javascript.json | 14 ++++++++++++++ public/data/python.json | 14 ++++++++++++++ public/data/rust.json | 16 ++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/public/data/cpp.json b/public/data/cpp.json index 57c64977..d5fe1f5e 100644 --- a/public/data/cpp.json +++ b/public/data/cpp.json @@ -1,4 +1,23 @@ [ + { + "categoryName": "Terminal Output", + "snippets": [ + { + "title": "Hello, World!", + "description": "Prints Hello, World! to the terminal.", + "code": [ + "#include // Includes the input/output stream library", + "", + "int main() { // Defines the main function", + " std::cout << \"Hello, World!\" << std::endl; // Outputs Hello, World! and a newline", + " return 0; // indicate the program executed successfully", + "}" + ], + "tags": ["cpp", "printing", "hello-world", "utility"], + "author": "James-Beans" + } + ] + }, { "categoryName": "String Manipulation", "snippets": [ diff --git a/public/data/javascript.json b/public/data/javascript.json index 327862c9..6319c0e9 100644 --- a/public/data/javascript.json +++ b/public/data/javascript.json @@ -1,4 +1,18 @@ [ + { + "categoryName": "Terminal Output", + "snippets": [ + { + "title": "Hello, World!", + "description": "Prints Hello, World! to the terminal.", + "code": [ + "console.log(\"Hello, World!\"); // Prints Hello, World! to the console" + ], + "tags": ["javascript", "printing", "hello-world", "utility"], + "author": "James-Beans" + } + ] + }, { "categoryName": "Array Manipulation", "snippets": [ diff --git a/public/data/python.json b/public/data/python.json index cd46c97e..d47eaff2 100644 --- a/public/data/python.json +++ b/public/data/python.json @@ -1,4 +1,18 @@ [ + { + "categoryName": "Terminal Output", + "snippets": [ + { + "title": "Hello, World!", + "description": "Prints Hello, World! to the terminal.", + "code": [ + "print(\"Hello, World!\") # Prints Hello, World! to the terminal." + ], + "tags": ["python", "printing", "hello-world", "utility"], + "author": "James-Beans" + } + ] + }, { "categoryName": "String Manipulation", "snippets": [ diff --git a/public/data/rust.json b/public/data/rust.json index 9d8aafd0..94417f27 100644 --- a/public/data/rust.json +++ b/public/data/rust.json @@ -1,4 +1,20 @@ [ + { + "categoryName": "Terminal Output", + "snippets": [ + { + "title": "Hello, World!", + "description": "Prints Hello, World! to the terminal.", + "code": [ + "fn main() { // Defines the main running function", + " println!(\"Hello, World!\"); // Prints Hello, World! to the terminal.", + "}" + ], + "tags": ["rust", "printing", "hello-world", "utility"], + "author": "James-Beans" + } + ] + }, { "categoryName": "String Manipulation", "snippets": [ From 8bf4afe635e2019f5f1d8831ccc59c9d2e3df825 Mon Sep 17 00:00:00 2001 From: james-beans Date: Sun, 29 Dec 2024 23:10:56 +0000 Subject: [PATCH 2/8] Update javascript.json changed the category name "terminal output" to just "output" in the category name of JavaScript. --- public/data/javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/javascript.json b/public/data/javascript.json index 6319c0e9..b247ed99 100644 --- a/public/data/javascript.json +++ b/public/data/javascript.json @@ -1,6 +1,6 @@ [ { - "categoryName": "Terminal Output", + "categoryName": "Output", "snippets": [ { "title": "Hello, World!", From 32e30811182aeb616d3d5f287cf6a6e7c499e8f0 Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:41:17 +0000 Subject: [PATCH 3/8] Update rust.json fix conflicts --- public/data/rust.json | 149 +++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 74 deletions(-) diff --git a/public/data/rust.json b/public/data/rust.json index 94417f27..0b494c93 100644 --- a/public/data/rust.json +++ b/public/data/rust.json @@ -1,4 +1,5 @@ [ + { { "categoryName": "Terminal Output", "snippets": [ @@ -14,78 +15,78 @@ "author": "James-Beans" } ] - }, - { - "categoryName": "String Manipulation", - "snippets": [ - { - "title": "Capitalize String", - "description": "Makes the first letter of a string uppercase.", - "code": [ - "fn capitalized(str: &str) -> String {", - " let mut chars = str.chars();", - " match chars.next() {", - " None => String::new(),", - " Some(f) => f.to_uppercase().chain(chars).collect(),", - " }", - "}", - "", - "// Usage:", - "assert_eq!(capitalized(\"lower_case\"), \"Lower_case\")" - ], - "tags": ["rust", "string", "capitalize", "utility"], - "author": "Mathys-Gasnier" - } - ] - }, - { - "categoryName": "File Handling", - "snippets": [ - { - "title": "Read File Lines", - "description": "Reads all lines from a file and returns them as a vector of strings.", - "code": [ - "fn read_lines(file_name: &str) -> std::io::Result>", - " Ok(", - " std::fs::read_to_string(file_name)?", - " .lines()", - " .map(String::from)", - " .collect()", - " )", - "}", - "", - "// Usage:", - "let lines = read_lines(\"path/to/file.txt\").expect(\"Failed to read lines from file\")" - ], - "tags": ["rust", "file", "read", "utility"], - "author": "Mathys-Gasnier" - }, - { - "title": "Find Files", - "description": "Finds all files of the specified extension within a given directory.", - "code": [ - "fn find_files(directory: &str, file_type: &str) -> std::io::Result> {", - " let mut result = vec![];", - "", - " for entry in std::fs::read_dir(directory)? {", - " let dir = entry?;", - " let path = dir.path();", - " if dir.file_type().is_ok_and(|t| !t.is_file()) &&", - " path.extension().is_some_and(|ext| ext != file_type) {", - " continue;", - " }", - " result.push(path)", - " }", - "", - " Ok(result)", - "}", - "", - "// Usage:", - "let files = find_files(\"/path/to/your/directory\", \".pdf\")" - ], - "tags": ["rust", "file", "search"], - "author": "Mathys-Gasnier" - } - ] - } +}, +{ + "categoryName": "String Manipulation", + "snippets": [ + { + "title": "Capitalize String", + "description": "Makes the first letter of a string uppercase.", + "code": [ + "fn capitalized(str: &str) -> String {", + " let mut chars = str.chars();", + " match chars.next() {", + " None => String::new(),", + " Some(f) => f.to_uppercase().chain(chars).collect(),", + " }", + "}", + "", + "// Usage:", + "assert_eq!(capitalized(\"lower_case\"), \"Lower_case\")" + ], + "tags": ["rust", "string", "capitalize", "utility"], + "author": "Mathys-Gasnier" + } + ] + }, + { + "categoryName": "File Handling", + "snippets": [ + { + "title": "Read File Lines", + "description": "Reads all lines from a file and returns them as a vector of strings.", + "code": [ + "fn read_lines(file_name: &str) -> std::io::Result>", + " Ok(", + " std::fs::read_to_string(file_name)?", + " .lines()", + " .map(String::from)", + " .collect()", + " )", + "}", + "", + "// Usage:", + "let lines = read_lines(\"path/to/file.txt\").expect(\"Failed to read lines from file\")" + ], + "tags": ["rust", "file", "read", "utility"], + "author": "Mathys-Gasnier" + }, + { + "title": "Find Files", + "description": "Finds all files of the specified extension within a given directory.", + "code": [ + "fn find_files(directory: &str, file_type: &str) -> std::io::Result> {", + " let mut result = vec![];", + "", + " for entry in std::fs::read_dir(directory)? {", + " let dir = entry?;", + " let path = dir.path();", + " if dir.file_type().is_ok_and(|t| !t.is_file()) &&", + " path.extension().is_some_and(|ext| ext != file_type) {", + " continue;", + " }", + " result.push(path)", + " }", + "", + " Ok(result)", + "}", + "", + "// Usage:", + "let files = find_files(\"/path/to/your/directory\", \".pdf\")" + ], + "tags": ["rust", "file", "search"], + "author": "Mathys-Gasnier" + } + ] + } ] From d3529cebdf014d14ddd0970a99b280e6167f431e Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:22:54 +0000 Subject: [PATCH 4/8] Update rust.json --- public/data/rust.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/data/rust.json b/public/data/rust.json index 8fc4bbfc..808371e0 100644 --- a/public/data/rust.json +++ b/public/data/rust.json @@ -14,7 +14,8 @@ "author": "James-Beans" } ] - }, + }, + { "categoryName": "String Manipulation", "snippets": [ { From c017c3c71bd6940004fb8d00c1da2c312fd7da74 Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:02:46 +0000 Subject: [PATCH 5/8] Update cpp.json --- public/data/cpp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/cpp.json b/public/data/cpp.json index 4cc75c48..d1ff6b2d 100644 --- a/public/data/cpp.json +++ b/public/data/cpp.json @@ -1,6 +1,6 @@ [ { - "categoryName": "Terminal Output", + "categoryName": "Basics", "snippets": [ { "title": "Hello, World!", From 700a0e62c28dde78b26ac931781fef8929c4f8b8 Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:03:09 +0000 Subject: [PATCH 6/8] Update javascript.json --- public/data/javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/javascript.json b/public/data/javascript.json index f1e1b947..a85bbcdf 100644 --- a/public/data/javascript.json +++ b/public/data/javascript.json @@ -1,6 +1,6 @@ [ { - "categoryName": "Output", + "categoryName": "Basics", "snippets": [ { "title": "Hello, World!", From 0f477ecde1f3ed7050cbc8f816809e1e84b5a6c0 Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:03:31 +0000 Subject: [PATCH 7/8] Update python.json --- public/data/python.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/python.json b/public/data/python.json index f4f7f42c..31111331 100644 --- a/public/data/python.json +++ b/public/data/python.json @@ -1,6 +1,6 @@ [ { - "categoryName": "Terminal Output", + "categoryName": "Basics", "snippets": [ { "title": "Hello, World!", From d4a54eeafd93799fbd7fce0c235d0ae444efa23a Mon Sep 17 00:00:00 2001 From: obvbeans <112166972+james-beans@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:03:57 +0000 Subject: [PATCH 8/8] Update rust.json --- public/data/rust.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/rust.json b/public/data/rust.json index 808371e0..75648018 100644 --- a/public/data/rust.json +++ b/public/data/rust.json @@ -1,6 +1,6 @@ [ { - "categoryName": "Terminal Output", + "categoryName": "Basics", "snippets": [ { "title": "Hello, World!",