Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd9f639

Browse files
committed
Merge remote-tracking branch 'origin/regex' into regex
2 parents 5ac43f7 + f1a7b49 commit dd9f639

File tree

5 files changed

+76
-12
lines changed

5 files changed

+76
-12
lines changed

‎public/consolidated/_index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
"lang": "PYTHON",
3636
"icon": "/icons/python.svg"
3737
},
38+
{
39+
"lang": "REGEX",
40+
"icon": "/icons/regex.svg"
41+
},
3842
{
3943
"lang": "RUST",
4044
"icon": "/icons/rust.svg"

‎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+
"categoryName": "Debuging",
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
"categoryName": "Math And Numbers",
3754
"snippets": [

‎public/consolidated/javascript.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@
8585
"description": "Converts RGB color values to hexadecimal color code.",
8686
"author": "jjcantu",
8787
"tags": [
88-
"javascript",
8988
"color",
90-
"conversion",
91-
"utility"
89+
"conversion"
9290
],
9391
"contributors": [],
9492
"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"
@@ -407,10 +405,8 @@
407405
"description": "Converts bytes into human-readable file size format.",
408406
"author": "jjcantu",
409407
"tags": [
410-
"javascript",
411408
"format",
412-
"size",
413-
"utility"
409+
"size"
414410
],
415411
"contributors": [],
416412
"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"
@@ -506,13 +502,11 @@
506502
"description": "Creates a deep copy of an object or array without reference.",
507503
"author": "jjcantu",
508504
"tags": [
509-
"javascript",
510505
"object",
511-
"clone",
512-
"utility"
506+
"clone"
513507
],
514508
"contributors": [],
515-
"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: { a: 1, b: { c: 2 }, d: [1, 2, 3] }\n"
509+
"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"
516510
},
517511
{
518512
"title": "Filter Object",
@@ -758,9 +752,9 @@
758752
"description": "Generates a UUID (v4) string.",
759753
"author": "jjcantu",
760754
"tags": [
761-
"javascript",
762755
"uuid",
763-
"utility"
756+
"generate",
757+
"string"
764758
],
765759
"contributors": [],
766760
"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"

‎public/consolidated/regex.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"categoryName": "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+
},
18+
{
19+
"categoryName": "Validation pattern",
20+
"snippets": [
21+
{
22+
"title": "Email Address",
23+
"description": "Match any email address",
24+
"author": "majvax",
25+
"tags": [
26+
"email"
27+
],
28+
"contributors": [],
29+
"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"
30+
},
31+
{
32+
"title": "Strong Password",
33+
"description": "Match password with at least 12 characters, one uppercased letter, one number, and one special character.",
34+
"author": "majvax",
35+
"tags": [
36+
"password"
37+
],
38+
"contributors": [],
39+
"code": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{12,}$\n\n-> Usage:\nlongpassword ✗\nlongpassw0rd ✗\nlongp@ssw0rd ✗\nLongp@ssw0rd ✓\n"
40+
}
41+
]
42+
}
43+
]

‎public/icons/regex.svg

Lines changed: 6 additions & 0 deletions
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /