Skip to content

Commit 7871367

Browse files
committed
Merge branch 'main' into feature/vitest-test-suite
2 parents 374455c + ef1eb88 commit 7871367

File tree

244 files changed

+997
-1908
lines changed

Some content is hidden

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

244 files changed

+997
-1908
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
text eol=lf

.github/pull_request_template.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
<!-- **ANY PULL REQUEST NOT FOLLOWING GUIDELINES OR NOT INCLUDING A DESCRIPTION WILL BE CLOSED !** -->
2+
13
# Description
24

3-
<!-- Please include a summary of your changes. -->
5+
<!-- Include a summary of your changes. -->
46

57
## Type of Change
68

CODE_OF_CONDUCT.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## QuickSnip Code of Conduct
2+
3+
QuickSnip is a welcoming and collaborative community for developers to organize, share, and discover code snippets. By participating in QuickSnip, you agree to uphold this code of conduct to maintain a friendly and inclusive environment.
4+
5+
### Short Version
6+
7+
- Be respectful to everyone in the community.
8+
- Avoid harassment, trolling, or spamming.
9+
- Ensure QuickSnip remains a safe and productive space for all.
10+
- Report any inappropriate behavior to [me](mailto:[email protected]), the owner of QuickSnip, or our [Discord team](https://discord.gg/UtJJcnsN).
11+
- No unauthorized bots without prior permission.
12+
13+
---
14+
15+
### Long Version
16+
17+
#### Harassment-Free Environment
18+
19+
We are committed to providing a harassment-free experience for everyone, regardless of gender, gender identity and expression, age, sexual orientation, disability, physical appearance, body size, race, ethnicity, national origin, or religion (or lack thereof). Examples of unacceptable behavior include:
20+
21+
- **Harassment:** Includes sexual language or imagery, deliberate intimidation, stalking, name-calling, unwelcome attention, libel, and malicious hacking or social engineering.
22+
- **Trolling:** Posting inflammatory comments to provoke an emotional response or disrupt discussions.
23+
- **Spamming:** Posting off-topic messages, promoting unrelated products, soliciting donations, advertising jobs or gigs, or flooding discussions with files or text.
24+
25+
#### Reporting Issues
26+
27+
If you experience or witness harassment, trolling, spamming, or any other inappropriate behavior, please report it to [me](mailto:[email protected]), the owner of QuickSnip, or our QuickSnip [Discord team](https://discord.gg/UtJJcnsN). Include details like screenshots and URLs, if possible, to help us address the issue effectively.
28+
29+
I, or the QuickSnip team will review all reports and take appropriate actions, which may include warnings, temporary bans, or permanent removal from the community.
30+
31+
#### Respectful Use of Bots
32+
33+
No bots are allowed within the QuickSnip community without prior written permission from the QuickSnip team. Unauthorized bots will be removed.
34+
35+
#### Final Notes
36+
37+
This code of conduct is inspired by [FreeCodeCamp’s approach](https://www.freecodecamp.org/news/code-of-conduct), emphasizing clarity and friendliness. Let’s work together to make QuickSnip a supportive and productive space for all developers!
38+

CONTRIBUTING.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,65 @@ If you have a feature request or want to fix a bug, feel free to:
1818

1919
---
2020

21+
## Snippets Guidelines
22+
23+
### Snippet Tags
24+
25+
Tags must describe the snippet with simple word. \
26+
For example a snippet that capitalize a word would have `string` and `capitalize` as tags. \
27+
**! Do not add the language you are using as a tag, nor some generic keyword like `utility` !**
28+
29+
### Snippet Format
30+
31+
**All** snippets should follow the following structure:
32+
- A `code` segment, containing a function with the actual snippet functionnality
33+
- An `example` segement, containing one or more examples of use
34+
35+
Example in javascript:
36+
```js
37+
function example(x) {
38+
return x * 2;
39+
}
40+
41+
// Usage:
42+
example(5) // Returns: 10
43+
```
44+
If your function doesn't return anything just show how to use it. \
45+
If the result of your function is too complicated to be expressed in a single comment, your snippet is probably too complex to begin with.
46+
47+
### Snippet boundaries
48+
49+
To **check if your snippet will not get refused** ask yourself those questions:
50+
- **Does the standard library of my language provide an easy way of doing this ?**
51+
- **Does that snippet have a real, and practical use case ?**
52+
- **Could it be split into separate parts to be better understood ?**
53+
54+
If one of question is true, then your snippet will most likely get refused !
55+
56+
---
57+
2158
## Adding Snippets
2259

2360
### Adding a New Snippet
2461

25-
To add a new code snippet:
62+
1. **Ensure your snippet match [guidelines](#snippets-guidelines)**
2663

27-
1. **Navigate to the relevant folder:**
64+
2. **Navigate to the relevant folder:**
2865

2966
- Go to the `/snippets` folder in the root directory.
3067
- Locate the folder for the programming language of your snippet, such as `javascript` or `python`.
3168

32-
2. **Choose the correct category:**
69+
3. **Choose the correct category:**
3370

3471
- Within the language folder, find the relevant category folder for your snippet.
3572
- If no suitable category exists, refer to [Adding a New Category](#adding-a-new-category).
3673

37-
3. **Create a markdown file:**
74+
4. **Create a markdown file:**
3875

3976
- Create a new file with a `.md` extension.
4077
- Name the file appropriately, keeping it descriptive and concise.
4178

42-
4. **Add your snippet:**
79+
5. **Add your snippet:**
4380

4481
- Use the following format to structure your snippet:
4582

@@ -74,11 +111,11 @@ console.log(formatDate(new Date())); // Output: '2024-12-10'
74111
```
75112
````
76113

77-
5. **Use syntax highlighting:**
114+
6. **Use syntax highlighting:**
78115
- Enclose your code with triple backticks (```).
79116
- Specify the language after the first set of backticks for syntax highlighting.
80117

81-
6. **Test your snippet:**
118+
7. **Test your snippet:**
82119
- Ensure your code runs as expected. \
83120
To test that your snippets are formatted correctly use the `snippets:check` script:
84121
```

VISION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Vision for QuickSnip
2+
3+
Will be updating soon...

cspell-dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
quicksnip
2+
slugifyed

eslint.config.js

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { fixupPluginRules } from "@eslint/compat";
22
import { FlatCompat } from "@eslint/eslintrc";
33
import js from "@eslint/js";
44
import globals from "globals";
5-
import reactPlugin from 'eslint-plugin-react';
5+
import reactPlugin from "eslint-plugin-react";
66
import reactHooks from "eslint-plugin-react-hooks";
77
import reactRefresh from "eslint-plugin-react-refresh";
88
import tseslint from "typescript-eslint";
@@ -49,46 +49,55 @@ export default tseslint.config(
4949
alwaysTryTypes: true,
5050
},
5151
},
52+
react: {
53+
version: "detect",
54+
},
5255
},
5356
rules: {
5457
...reactHooks.configs.recommended.rules,
5558
"@typescript-eslint/no-empty-object-type": "off",
56-
"@typescript-eslint/no-unused-vars": ["error", {
57-
"argsIgnorePattern": "^_",
58-
"varsIgnorePattern": "^_",
59-
"caughtErrorsIgnorePattern": "^_"
60-
}],
61-
"import/order": ["error", {
62-
"groups": [
63-
"builtin",
64-
"external",
65-
"internal",
66-
["parent", "sibling"],
67-
"index",
68-
"object",
69-
"type",
70-
"unknown"
71-
],
72-
"pathGroups": [
73-
{
74-
"pattern": "@*",
75-
"group": "internal",
76-
"position": "after"
77-
}
78-
],
79-
"pathGroupsExcludedImportTypes": ["builtin", "internal"],
80-
"newlines-between": "always",
81-
"alphabetize": {
82-
"order": "asc",
83-
"caseInsensitive": true
84-
}
85-
}],
59+
"@typescript-eslint/no-unused-vars": [
60+
"error",
61+
{
62+
argsIgnorePattern: "^_",
63+
varsIgnorePattern: "^_",
64+
caughtErrorsIgnorePattern: "^_",
65+
},
66+
],
67+
"import/order": [
68+
"error",
69+
{
70+
groups: [
71+
"builtin",
72+
"external",
73+
"internal",
74+
["parent", "sibling"],
75+
"index",
76+
"object",
77+
"type",
78+
"unknown",
79+
],
80+
pathGroups: [
81+
{
82+
pattern: "@*",
83+
group: "internal",
84+
position: "after",
85+
},
86+
],
87+
pathGroupsExcludedImportTypes: ["builtin", "internal"],
88+
"newlines-between": "always",
89+
alphabetize: {
90+
order: "asc",
91+
caseInsensitive: true,
92+
},
93+
},
94+
],
8695
"react/react-in-jsx-scope": "off",
8796
"react-refresh/only-export-components": [
8897
"warn",
8998
{ allowConstantExport: true },
9099
],
91-
"semi": ["error", "always"],
100+
semi: ["error", "always"],
92101
},
93102
}
94103
);

public/consolidated/_index.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"lang": "HTML",
2424
"icon": "/icons/html.svg"
2525
},
26+
{
27+
"lang": "JAVA",
28+
"icon": "/icons/java.svg"
29+
},
2630
{
2731
"lang": "JAVASCRIPT",
2832
"icon": "/icons/javascript.svg"
@@ -38,5 +42,9 @@
3842
{
3943
"lang": "SCSS",
4044
"icon": "/icons/scss.svg"
45+
},
46+
{
47+
"lang": "TYPESCRIPT",
48+
"icon": "/icons/typescript.svg"
4149
}
4250
]

public/consolidated/c.json

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
"description": "Prints Hello, World! to the terminal.",
88
"author": "0xHouss",
99
"tags": [
10-
"c",
1110
"printing",
12-
"hello-world",
13-
"utility"
11+
"hello-world"
1412
],
1513
"contributors": [],
1614
"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"
@@ -25,26 +23,11 @@
2523
"description": "Calculates the factorial of a number.",
2624
"author": "0xHouss",
2725
"tags": [
28-
"c",
2926
"math",
30-
"factorial",
31-
"utility"
27+
"factorial"
3228
],
3329
"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"
30+
"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\n// Usage:\nfactorial(4); // Returns: 24\n"
4831
}
4932
]
5033
}

public/consolidated/cpp.json

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
"description": "Prints Hello, World! to the terminal.",
88
"author": "James-Beans",
99
"tags": [
10-
"cpp",
1110
"printing",
12-
"hello-world",
13-
"utility"
11+
"hello-world"
1412
],
1513
"contributors": [],
1614
"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"
@@ -25,13 +23,12 @@
2523
"description": "Convert vector into queue quickly",
2624
"author": "mrityunjay2003",
2725
"tags": [
28-
"cpp",
2926
"data structures",
3027
"queue",
3128
"vector"
3229
],
3330
"contributors": [],
34-
"code": "#include<queue>\n#include<vector>\n#include<deque>\n\nstd::queue<int> vectorToQueue(const std::vector<int>& v) {\n return std::queue<int>(std::deque<int>(v.begin(), v.end()));\n}\n"
31+
"code": "#include<queue>\n#include<vector>\n#include<deque>\n\nstd::queue<int> vectorToQueue(const std::vector<int>& v) {\n return std::queue<int>(std::deque<int>(v.begin(), v.end()));\n}\n\nstd::vector<int> vec = { 1, 2, 3, 4, 5 };\nvectorToQueue(&vec); // Returns: std::queue<int> { 1, 2, 3, 4, 5 }\n"
3532
}
3633
]
3734
},
@@ -43,12 +40,11 @@
4340
"description": "Check if an integer is a prime number",
4441
"author": "MihneaMoso",
4542
"tags": [
46-
"cpp",
4743
"number",
4844
"prime"
4945
],
5046
"contributors": [],
51-
"code": "bool is_prime(int n) {\n if (n < 2) return false;\n if (n == 2 || n == 3) return true;\n if (n % 2 == 0) return false;\n for (int i = 3; i * i <= n; i += 2) {\n if (n % i == 0) return false;\n }\n return true;\n}\n\n// Usage\n#include <iostream>\n\nint main() {\n std::cout << is_prime(29) << std::endl; // Output: 1\n return 0;\n}\n"
47+
"code": "bool is_prime(int n) {\n if (n < 2) return false;\n if (n == 2 || n == 3) return true;\n if (n % 2 == 0) return false;\n for (int i = 3; i * i <= n; i += 2) {\n if (n % i == 0) return false;\n }\n return true;\n}\n\n// Usage:\nis_prime(29); // Returns: true\n"
5248
}
5349
]
5450
},
@@ -60,26 +56,22 @@
6056
"description": "Reverses the characters in a string.",
6157
"author": "Vaibhav-kesarwani",
6258
"tags": [
63-
"cpp",
6459
"array",
65-
"reverse",
66-
"utility"
60+
"reverse"
6761
],
6862
"contributors": [],
69-
"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"
63+
"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\nreverseString(\"quicksnip\"); // Returns: \"pinskciuq\"\n"
7064
},
7165
{
7266
"title": "Split String",
7367
"description": "Splits a string by a delimiter",
7468
"author": "saminjay",
7569
"tags": [
76-
"cpp",
7770
"string",
78-
"split",
79-
"utility"
71+
"split"
8072
],
8173
"contributors": [],
82-
"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"
74+
"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\n// Usage:\nsplit_string(\"quick_-snip\", \"_-\"); // Returns: std::vector<std::string> { \"quick\", \"snip\" }\n"
8375
}
8476
]
8577
}

0 commit comments

Comments
 (0)