Skip to content

Commit 438de62

Browse files
Merge branch 'main'
2 parents 8261129 + 9105c2a commit 438de62

Some content is hidden

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

41 files changed

+1322
-3
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
* @Mathys-Gasnier
55

66
# Code maintainers
7-
/src/ @psychlone77 @saminjay
7+
/src/ @psychlone77 @saminjay @Mathys-Gasnier
88

99
# Snippets maintainers
10-
/snippets @Mathys-Gasnier
10+
/snippets @majvax @Mathys-Gasnier
11+
/snippets/javascript @psychlone77 @saminjay
12+
/snippets/python @psychlone77 @saminjay
13+
/snippets/cpp @saminjay
1114

1215

1316
# ---------- What is a maintainer ----------

VISION.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
11
# Vision for QuickSnip
22

3-
Will be updating soon...
3+
## What is QuickSnip?
4+
5+
QuickSnip is an open-source tool designed for developers who want to organize, search, and share code snippets. It aims to streamline the coding process by providing a centralized platform for snippet management.
6+
7+
## Core Principles
8+
9+
- **Developer Focused**: Focus on features that truly improve developer productivity.
10+
11+
- **Open and Extensible**: Encourage community contributions and integrations.
12+
13+
- **Lightweight and Fast**: Keep performance high and avoid unnecessary complexity.
14+
15+
## Our Goals
16+
17+
- Seamless snippet management without turning into an overly complex tool
18+
19+
- Enable collaboration and sharing while respecting user privacy and customization needs.
20+
21+
We do **NOT** aim to be:
22+
23+
- a component library
24+
- a documentation
25+
26+
## QuickSnip Roadmap
27+
28+
### v1.0 (Launching Soon)
29+
30+
- [x] A new snippets storage system for better maintainability and scalability
31+
- [ ] Search functionality
32+
- [ ] A support for frameworks and libraries
33+
- [ ] An ability to share snippets with others
34+
- [ ] A basic SEO (Search Engine Optimization)
35+
36+
### v2.0 (Planned Vision)
37+
38+
- [ ] An ability to have private snippets with personal account
39+
- [ ] Improved search functionality with filters
40+
- [ ] An improved SEO (Search Engine Optimization)
41+
42+
### Potential Future Ideas
43+
44+
- [ ] Plugins for IDEs like VS Code and JetBrains
45+
- [ ] Enterprise-grade support for larger organizations
46+
47+
## Disclaimer on Future Plans
48+
49+
This roadmap outlines our current vision for QuickSnip and may evolve based on user feedback, community contributions, and shifting priorities. We welcome your input and encourage you to help shape QuickSnip’s future.
50+
51+
## Future Vision
52+
53+
QuickSnip aims to become the preferred platform for developers to store, retrieve, and collaborate on code snippets.
54+
55+
Explore our [GitHub Releases](https://github.com/dostonnabotov/quicksnip/releases) for updates and join us on this journey.

public/consolidated/_index.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@
4444
"icon": "/icons/python.svg",
4545
"subLanguages": []
4646
},
47+
{
48+
"name": "REGEX",
49+
"icon": "/icons/regex.svg",
50+
"subLanguages": []
51+
},
52+
{
53+
"name": "RUBY",
54+
"icon": "/icons/ruby.svg",
55+
"subLanguages": []
56+
},
4757
{
4858
"name": "RUST",
4959
"icon": "/icons/rust.svg",

public/consolidated/c.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
],
2929
"contributors": [],
3030
"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"
31+
},
32+
{
33+
"title": "Swap numbers",
34+
"description": "Swaps two numbers without using third variable",
35+
"author": "Emosans",
36+
"tags": [
37+
"swap",
38+
"numbers"
39+
],
40+
"contributors": [],
41+
"code": "#include<stdio.h>\nvoid swap(int* num1,int* num2){\n *num1 = *num1 + *num2;\n *num2 = *num1 - *num2;\n *num1 = *num1 - *num2;\n}\n\n// Usage:\nint a = 3,b = 4;\nswap(&a,&b); // swaps the values of the a and b variables\n"
3142
}
3243
]
3344
}

public/consolidated/cpp.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@
3232
}
3333
]
3434
},
35+
{
36+
"name": "Debugging",
37+
"snippets": [
38+
{
39+
"title": "Vector Print",
40+
"description": "Overloads the << operator to print the contents of a vector just like in python.",
41+
"author": "Mohamed-faaris",
42+
"tags": [
43+
"printing",
44+
"debuging",
45+
"vector"
46+
],
47+
"contributors": [],
48+
"code": "#include <iostream> \n#include <vector> \n\ntemplate <typename T>\nstd::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {\n os << \"[\"; \n for (size_t i = 0; i < vec.size(); ++i) {\n os << vec[i]; // Print each vector element\n if (i != vec.size() - 1) {\n os << \", \"; // Add separator\n }\n }\n os << \"]\"; \n return os; // Return the stream\n}\n\n// Usage:\nstd::vector<int> numbers = {1, 2, 3, 4, 5};\nstd::cout << numbers << std::endl; // Outputs: [1, 2, 3, 4, 5]\n\n"
49+
}
50+
]
51+
},
3552
{
3653
"name": "Math And Numbers",
3754
"snippets": [

public/consolidated/javascript.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@
7777
}
7878
]
7979
},
80+
{
81+
"name": "Color Manipulation",
82+
"snippets": [
83+
{
84+
"title": "RGB to Hex Color",
85+
"description": "Converts RGB color values to hexadecimal color code.",
86+
"author": "jjcantu",
87+
"tags": [
88+
"color",
89+
"conversion"
90+
],
91+
"contributors": [],
92+
"code": "function rgbToHex(r, g, b) {\n const toHex = (n) => {\n const hex = n.toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n };\n \n return '#' + toHex(r) + toHex(g) + toHex(b);\n}\n\n// Usage:\nconsole.log(rgbToHex(255, 128, 0)); // Output: \"#ff8000\"\nconsole.log(rgbToHex(0, 255, 0)); // Output: \"#00ff00\"\n"
93+
}
94+
]
95+
},
8096
{
8197
"name": "Date And Time",
8298
"snippets": [
@@ -348,6 +364,22 @@
348364
}
349365
]
350366
},
367+
{
368+
"name": "Mathematical Functions",
369+
"snippets": [
370+
{
371+
"title": "Greatest Common Divisor",
372+
"description": "Calculates the largest positive integer that divides each of the integers without leaving a remainder. Useful for calculating aspect ratios.",
373+
"author": "JanluOfficial",
374+
"tags": [
375+
"math",
376+
"division"
377+
],
378+
"contributors": [],
379+
"code": "function gcd(a, b) {\n while (b !== 0) {\n let temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n}\n\n// Usage:\ngcd(1920, 1080); // Returns: 120\ngcd(1920, 1200); // Returns: 240\ngcd(5,12); // Returns: 1\n"
380+
}
381+
]
382+
},
351383
{
352384
"name": "Number Formatting",
353385
"snippets": [
@@ -384,6 +416,17 @@
384416
"contributors": [],
385417
"code": "const toScientificNotation = (num) => {\n if (isNaN(num)) {\n throw new Error('Input must be a number');\n }\n if (num === 0) {\n return '0e+0';\n }\n const exponent = Math.floor(Math.log10(Math.abs(num)));\n const mantissa = num / Math.pow(10, exponent);\n return `${mantissa.toFixed(2)}e${exponent >= 0 ? '+' : ''}${exponent}`;\n};\n\n// Usage:\ntoScientificNotation(12345); // Returns: '1.23e+4'\ntoScientificNotation(0.0005678); // Returns: '5.68e-4'\ntoScientificNotation(1000); // Returns: '1.00e+3'\ntoScientificNotation(0); // Returns: '0e+0'\ntoScientificNotation(-54321); // Returns: '-5.43e+4'\n"
386418
},
419+
{
420+
"title": "Format File Size",
421+
"description": "Converts bytes into human-readable file size format.",
422+
"author": "jjcantu",
423+
"tags": [
424+
"format",
425+
"size"
426+
],
427+
"contributors": [],
428+
"code": "function formatFileSize(bytes) {\n if (bytes === 0) return '0 Bytes';\n \n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n \n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n}\n\n// Usage:\nconsole.log(formatFileSize(1234)); // Output: \"1.21 KB\"\nconsole.log(formatFileSize(1234567)); // Output: \"1.18 MB\"\n"
429+
},
387430
{
388431
"title": "Format Number with Commas",
389432
"description": "Formats a number with commas for better readability (e.g., 1000 -> 1,000).",
@@ -470,6 +513,17 @@
470513
"contributors": [],
471514
"code": "function countProperties(obj) {\n return Object.keys(obj).length;\n}\n\n// Usage:\nconst obj = { a: 1, b: 2, c: 3 };\ncountProperties(obj); // Returns: 3\n"
472515
},
516+
{
517+
"title": "Deep Clone Object",
518+
"description": "Creates a deep copy of an object or array without reference.",
519+
"author": "jjcantu",
520+
"tags": [
521+
"object",
522+
"clone"
523+
],
524+
"contributors": [],
525+
"code": "function deepClone(obj) {\n if (obj === null || typeof obj !== 'object') return obj;\n \n const clone = Array.isArray(obj) ? [] : {};\n \n for (let key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clone[key] = deepClone(obj[key]);\n }\n }\n \n return clone;\n}\n\n// Usage:\nconst original = { a: 1, b: { c: 2 }, d: [1, 2, 3] };\nconst cloned = deepClone(original);\nconsole.log(cloned); // Output: 'original' but cloned\n"
526+
},
473527
{
474528
"title": "Filter Object",
475529
"description": "Filter out entries in an object where the value is falsy, including empty strings, empty objects, null, and undefined.",
@@ -709,6 +763,18 @@
709763
"contributors": [],
710764
"code": "function getInitials(name) {\n return name.split(' ').map(part => part.charAt(0).toUpperCase()).join('');\n}\n\n// Usage:\ngetInitials('John Doe'); // Returns: 'JD'\n"
711765
},
766+
{
767+
"title": "Generate UUID",
768+
"description": "Generates a UUID (v4) string.",
769+
"author": "jjcantu",
770+
"tags": [
771+
"uuid",
772+
"generate",
773+
"string"
774+
],
775+
"contributors": [],
776+
"code": "function generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n const r = Math.random() * 16 | 0;\n const v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}\n\n// Usage:\nconsole.log(generateUUID()); // Output: \"a1b2c3d4-e5f6-4g7h-8i9j-k0l1m2n3o4p5\"\n"
777+
},
712778
{
713779
"title": "Mask Sensitive Information",
714780
"description": "Masks parts of a sensitive string, like a credit card or email address.",

public/consolidated/regex.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[
2+
{
3+
"name": "Miscellaneous",
4+
"snippets": [
5+
{
6+
"title": "Hexadecimal Color",
7+
"description": "Matches hex color codes",
8+
"author": "majvax",
9+
"tags": [
10+
"color",
11+
"hexadecimal"
12+
],
13+
"contributors": [],
14+
"code": "^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$\n\n\n-> Usage:\n#FFF1 ✗\n#FFF ✓\n#FFF000 ✓\n"
15+
},
16+
{
17+
"title": "IPv4",
18+
"description": "Matches IPv4 address",
19+
"author": "majvax",
20+
"tags": [
21+
"ipv4",
22+
"networking"
23+
],
24+
"contributors": [],
25+
"code": "^((25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.){3}(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})$\n\n\n-> Usage:\n123.300.0.101 ✗\n127.0.0.1 ✓\n192.168.0.1 ✓\n"
26+
},
27+
{
28+
"title": "Unintentional Duplication",
29+
"description": "Matches duplicated word in a text.",
30+
"author": "majvax",
31+
"tags": [
32+
"duplication"
33+
],
34+
"contributors": [],
35+
"code": "\\b(\\w+)\\s+\\1\\b\n\n\n-> Usage:\nI need to finish this task ✗\nI need to to finish this task ✓\n"
36+
},
37+
{
38+
"title": "Whitespace Trimmer",
39+
"description": "Matches leading and/or trailing whitespace.",
40+
"author": "majvax",
41+
"tags": [
42+
"trim"
43+
],
44+
"contributors": [],
45+
"code": "^\\s+|\\s+$\n\n\n-> Usage:\n(don't account for the quotation marks, it just to visualize whitespace)\n\"Hello World\"\n\" Hello World\"\n\"Hello World \"\n\" Hello World \"\n"
46+
}
47+
]
48+
},
49+
{
50+
"name": "Validation pattern",
51+
"snippets": [
52+
{
53+
"title": "Email Address",
54+
"description": "Match any email address",
55+
"author": "majvax",
56+
"tags": [
57+
"email"
58+
],
59+
"contributors": [],
60+
"code": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$\n\n-> Usage:\nexample.name@domain.com.ru ✓\nname.surname@gmail.com ✓\n"
61+
},
62+
{
63+
"title": "Strong Password",
64+
"description": "Match password with at least 12 characters, one uppercased letter, one number, and one special character.",
65+
"author": "majvax",
66+
"tags": [
67+
"password"
68+
],
69+
"contributors": [],
70+
"code": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{12,}$\n\n-> Usage:\nlongpassword ✗\nlongpassw0rd ✗\nlongp@ssw0rd ✗\nLongp@ssw0rd ✓\n"
71+
}
72+
]
73+
}
74+
]

0 commit comments

Comments
 (0)