Skip to content

Commit 84f4571

Browse files
Merge pull request #88 from Mathys-Gasnier/features/migrating-snippet-format
Migrating the snippet format to a markdown approach
2 parents 9c4774e + 8d58753 commit 84f4571

File tree

204 files changed

+7715
-6763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+7715
-6763
lines changed

public/consolidated/all_snippets.json

Lines changed: 1468 additions & 3279 deletions
Large diffs are not rendered by default.

public/data/_index.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
[
2-
{
3-
"lang": "JavaScript",
4-
"icon": "/icons/javascript.svg"
5-
},
6-
{
7-
"lang": "CSS",
8-
"icon": "/icons/css.svg"
9-
},
10-
{
11-
"lang": "HTML",
12-
"icon": "/icons/html5.svg"
13-
},
14-
{
15-
"lang": "Python",
16-
"icon": "/icons/python.svg"
17-
},
18-
{
19-
"lang": "SCSS",
20-
"icon": "/icons/sass.svg"
21-
},
22-
{
23-
"lang": "CPP",
24-
"icon": "/icons/cpp.svg"
25-
},
26-
{
27-
"lang": "C",
28-
"icon": "/icons/c.svg"
29-
},
30-
{
31-
"lang": "Rust",
32-
"icon": "/icons/rust.svg"
33-
}
34-
]
2+
{
3+
"lang": "C",
4+
"icon": "/icons/c.svg"
5+
},
6+
{
7+
"lang": "CPP",
8+
"icon": "/icons/cpp.svg"
9+
},
10+
{
11+
"lang": "CSS",
12+
"icon": "/icons/css.svg"
13+
},
14+
{
15+
"lang": "HTML",
16+
"icon": "/icons/html.svg"
17+
},
18+
{
19+
"lang": "JAVASCRIPT",
20+
"icon": "/icons/javascript.svg"
21+
},
22+
{
23+
"lang": "PYTHON",
24+
"icon": "/icons/python.svg"
25+
},
26+
{
27+
"lang": "RUST",
28+
"icon": "/icons/rust.svg"
29+
},
30+
{
31+
"lang": "SCSS",
32+
"icon": "/icons/scss.svg"
33+
}
34+
]

public/data/c.json

Lines changed: 49 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,51 @@
11
[
2-
{
3-
"categoryName": "Basics",
4-
"snippets": [
5-
{
6-
"title": "Hello, World!",
7-
"description": "Prints Hello, World! to the terminal.",
8-
"code": [
9-
"#include <stdio.h> // Includes the input/output library",
10-
"",
11-
"int main() { // Defines the main function",
12-
" printf(\"Hello, World!\\n\") // Outputs Hello, World! and a newline",
13-
"",
14-
" return 0; // indicate the program executed successfully",
15-
"}"
16-
],
17-
"tags": ["c", "printing", "hello-world", "utility"],
18-
"author": "0xHouss"
19-
}
20-
]
21-
},
22-
{
23-
"categoryName": "Mathematical Functions",
24-
"snippets": [
25-
{
26-
"title": "Factorial Function",
27-
"description": "Calculates the factorial of a number.",
28-
"code": [
29-
"int factorial(int x) {",
30-
" int y = 1;",
31-
"",
32-
" for (int i = 2; i <= x; i++)",
33-
" y *= i;",
34-
"",
35-
" return y;",
36-
"}"
37-
],
38-
"tags": ["c", "math", "factorial", "utility"],
39-
"author": "0xHouss"
40-
},
41-
{
42-
"title": "Power Function",
43-
"description": "Calculates the power of a number.",
44-
"code": [
45-
"int power(int x, int n) {",
46-
" int y = 1;",
47-
"",
48-
" for (int i = 0; i < n; i++)",
49-
" y *= x;",
50-
"",
51-
" return y;",
52-
"}"
53-
],
54-
"tags": ["c", "math", "power", "utility"],
55-
"author": "0xHouss"
56-
}
57-
]
58-
}
2+
{
3+
"categoryName": "Basics",
4+
"snippets": [
5+
{
6+
"title": "Hello, World!",
7+
"description": "Prints Hello, World! to the terminal.",
8+
"author": "0xHouss",
9+
"tags": [
10+
"c",
11+
"printing",
12+
"hello-world",
13+
"utility"
14+
],
15+
"contributors": [],
16+
"code": "#include <stdio.h> // Includes the input/output library\n\nint main() { // Defines the main function\n printf(\"Hello, World!\\n\") // Outputs Hello, World! and a newline\n\n return 0; // indicate the program executed successfully\n}\n"
17+
}
18+
]
19+
},
20+
{
21+
"categoryName": "Mathematical Functions",
22+
"snippets": [
23+
{
24+
"title": "Factorial Function",
25+
"description": "Calculates the factorial of a number.",
26+
"author": "0xHouss",
27+
"tags": [
28+
"c",
29+
"math",
30+
"factorial",
31+
"utility"
32+
],
33+
"contributors": [],
34+
"code": "int factorial(int x) {\n int y = 1;\n\n for (int i = 2; i <= x; i++)\n y *= i;\n\n return y;\n}\n"
35+
},
36+
{
37+
"title": "Power Function",
38+
"description": "Calculates the power of a number.",
39+
"author": "0xHouss",
40+
"tags": [
41+
"c",
42+
"math",
43+
"power",
44+
"utility"
45+
],
46+
"contributors": [],
47+
"code": "int power(int x, int n) {\n int y = 1;\n\n for (int i = 0; i < n; i++)\n y *= x;\n\n return y;\n}\n"
48+
}
49+
]
50+
}
5951
]

public/data/cpp.json

Lines changed: 50 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,51 @@
11
[
2-
{
3-
"categoryName": "Basics",
4-
"snippets": [
5-
{
6-
"title": "Hello, World!",
7-
"description": "Prints Hello, World! to the terminal.",
8-
"code": [
9-
"#include <iostream> // Includes the input/output stream library",
10-
"",
11-
"int main() { // Defines the main function",
12-
" std::cout << \"Hello, World!\" << std::endl; // Outputs Hello, World! and a newline",
13-
" return 0; // indicate the program executed successfully",
14-
"}"
15-
],
16-
"tags": ["cpp", "printing", "hello-world", "utility"],
17-
"author": "James-Beans"
18-
}
19-
]
20-
},
21-
{
22-
"categoryName": "String Manipulation",
23-
"snippets": [
24-
{
25-
"title": "Reverse String",
26-
"description": "Reverses the characters in a string.",
27-
"code": [
28-
"#include <string>",
29-
"#include <algorithm>",
30-
"",
31-
"std::string reverseString(const std::string& input) {",
32-
" std::string reversed = input;",
33-
" std::reverse(reversed.begin(), reversed.end());",
34-
" return reversed;",
35-
"}"
36-
],
37-
"tags": ["cpp", "array", "reverse", "utility"],
38-
"author": "Vaibhav-kesarwani"
39-
},
40-
{
41-
"title": "Split String",
42-
"description": "Splits a string by a delimiter",
43-
"code": [
44-
"#include <string>",
45-
"#include <vector>",
46-
"",
47-
"std::vector<std::string> split_string(std::string str, std::string delim) {",
48-
" std::vector<std::string> splits;",
49-
" int i = 0, j;",
50-
" int inc = delim.length();",
51-
" while (j != std::string::npos) {",
52-
" j = str.find(delim, i);",
53-
" splits.push_back(str.substr(i, j - i));",
54-
" i = j + inc;",
55-
" }",
56-
" return splits;",
57-
"}"
58-
],
59-
"tags": ["cpp", "string", "split", "utility"],
60-
"author": "saminjay"
61-
}
62-
]
63-
}
64-
]
2+
{
3+
"categoryName": "Basics",
4+
"snippets": [
5+
{
6+
"title": "Hello, World!",
7+
"description": "Prints Hello, World! to the terminal.",
8+
"author": "James-Beans",
9+
"tags": [
10+
"cpp",
11+
"printing",
12+
"hello-world",
13+
"utility"
14+
],
15+
"contributors": [],
16+
"code": "#include <iostream> // Includes the input/output stream library\n\nint main() { // Defines the main function\n std::cout << \"Hello, World!\" << std::endl; // Outputs Hello, World! and a newline\n return 0; // indicate the program executed successfully\n}\n"
17+
}
18+
]
19+
},
20+
{
21+
"categoryName": "String Manipulation",
22+
"snippets": [
23+
{
24+
"title": "Reverse String",
25+
"description": "Reverses the characters in a string.",
26+
"author": "Vaibhav-kesarwani",
27+
"tags": [
28+
"cpp",
29+
"array",
30+
"reverse",
31+
"utility"
32+
],
33+
"contributors": [],
34+
"code": "#include <string>\n#include <algorithm>\n\nstd::string reverseString(const std::string& input) {\n std::string reversed = input;\n std::reverse(reversed.begin(), reversed.end());\n return reversed;\n}\n"
35+
},
36+
{
37+
"title": "Split String",
38+
"description": "Splits a string by a delimiter",
39+
"author": "saminjay",
40+
"tags": [
41+
"cpp",
42+
"string",
43+
"split",
44+
"utility"
45+
],
46+
"contributors": [],
47+
"code": "#include <string>\n#include <vector>\n\nstd::vector<std::string> split_string(std::string str, std::string delim) {\n std::vector<std::string> splits;\n int i = 0, j;\n int inc = delim.length();\n while (j != std::string::npos) {\n j = str.find(delim, i);\n splits.push_back(str.substr(i, j - i));\n i = j + inc;\n }\n return splits;\n}\n"
48+
}
49+
]
50+
}
51+
]

0 commit comments

Comments
 (0)