Skip to content

Commit f4440cd

Browse files
committed
Update consolidated snippets
1 parent e17f57a commit f4440cd

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed

public/consolidated/cpp.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
]
3434
},
3535
{
36-
"categoryName": "Debuging",
3736
"name": "Debugging",
3837
"snippets": [
3938
{
@@ -50,6 +49,23 @@
5049
}
5150
]
5251
},
52+
{
53+
"name": "Debuging",
54+
"snippets": [
55+
{
56+
"title": "Vector Print",
57+
"description": "Overloads the << operator to print the contents of a vector just like in python.",
58+
"author": "Mohamed-faaris",
59+
"tags": [
60+
"printing",
61+
"debuging",
62+
"vector"
63+
],
64+
"contributors": [],
65+
"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"
66+
}
67+
]
68+
},
5369
{
5470
"name": "Math And Numbers",
5571
"snippets": [

public/consolidated/css.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,67 @@
11
[
2+
{
3+
"name": "Animations",
4+
"snippets": [
5+
{
6+
"title": "Blink Animation",
7+
"description": "Adds an infinite blinking animation to an element",
8+
"author": "AlsoKnownAs-Ax",
9+
"tags": [
10+
"animation",
11+
"blink",
12+
"infinite"
13+
],
14+
"contributors": [],
15+
"code": ".blink {\n animation: blink 1s linear infinite;\n}\n\n@keyframes blink{\n 0%{\n opacity: 0;\n }\n 50%{\n opacity: 1;\n }\n 100%{\n opacity: 0;\n }\n}\n"
16+
},
17+
{
18+
"title": "Pulse Animation",
19+
"description": "Adds a smooth pulsing animation with opacity and scale effects",
20+
"author": "AlsoKnownAs-Ax",
21+
"tags": [
22+
"animation",
23+
"pulse",
24+
"pulse-scale"
25+
],
26+
"contributors": [],
27+
"code": ".pulse {\n animation: pulse 2s ease-in-out infinite;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 0.5;\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 100% {\n opacity: 0.5;\n transform: scale(1);\n }\n}\n"
28+
},
29+
{
30+
"title": "Shake Animation",
31+
"description": "Adds a shake animation ( commonly used to mark invalid fields )",
32+
"author": "AlsoKnownAs-Ax",
33+
"tags": [
34+
"shake",
35+
"shake-horizontal"
36+
],
37+
"contributors": [],
38+
"code": ".shake {\n animation: shake .5s ease-in-out;\n}\n\n@keyframes shake {\n 0%, 100% {\n transform: translateX(0);\n }\n 25% {\n transform: translateX(-10px);\n }\n 50% {\n transform: translateX(10px);\n }\n 75% {\n transform: translateX(-10px);\n }\n}\n"
39+
},
40+
{
41+
"title": "Slide-in Animation",
42+
"description": "Adds a slide-in from the right side of the screen",
43+
"author": "AlsoKnownAs-Ax",
44+
"tags": [
45+
"animation",
46+
"slide-in",
47+
"slide-right"
48+
],
49+
"contributors": [],
50+
"code": ".slide-in {\n animation: slide-in 1s ease-in-out;\n}\n\n@keyframes slide-in {\n from {\n scale: 300% 1;\n translate: 150vw 0;\n }\n\n to {\n scale: 100% 1;\n translate: 0 0;\n }\n}\n"
51+
},
52+
{
53+
"title": "Typewriter Animation",
54+
"description": "Adds a typewriter animation + blinking cursor",
55+
"author": "AlsoKnownAs-Ax",
56+
"tags": [
57+
"blinking",
58+
"typewriter"
59+
],
60+
"contributors": [],
61+
"code": " <div class=\"typewriter\">\n <div>\n <p>Typerwriter Animation</p>\n </div>\n </div>\n```\n\n```css\n .typewriter{\n display: flex;\n justify-content: center;\n }\n\n .typewriter p {\n overflow: hidden;\n font-size: 1.5rem;\n font-family: monospace;\n border-right: 1px solid;\n margin-inline: auto;\n white-space: nowrap;\n /* The cursor will inherit the text's color by default */\n /* border-color: red */ \n /* Steps: number of chars (better to set directly in js)*/\n animation: typing 3s steps(21) forwards,\n blink 1s step-end infinite;\n }\n\n @keyframes typing{\n from{\n width: 0%\n }\n to{\n width: 100%\n }\n }\n\n @keyframes blink{\n 50%{\n border-color: transparent;\n }\n }\n"
62+
}
63+
]
64+
},
265
{
366
"name": "Buttons",
467
"snippets": [

public/consolidated/java.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
[
2+
{
3+
"name": "Array Manipulation",
4+
"snippets": [
5+
{
6+
"title": "Zip Two Lists",
7+
"description": "Zips two lists into a list of paired elements, combining corresponding elements from both lists.",
8+
"author": "davidanukam",
9+
"tags": [
10+
"lists",
11+
"zip",
12+
"stream-api",
13+
"collections"
14+
],
15+
"contributors": [],
16+
"code": "import java.util.*; // Importing utility classes for List and Arrays\nimport java.util.stream.IntStream; // Importing IntStream for range and mapping\nimport java.util.stream.Collectors; // Importing Collectors for collecting stream results\n\npublic <A, B> List<List<Object>> zip(List<A> list1, List<B> list2) {\n // Create pairs by iterating through the indices of both lists\n return IntStream.range(0, Math.min(list1.size(), list2.size())) // Limit the range to the smaller list\n .mapToObj(i -> Arrays.asList(list1.get(i), list2.get(i))) // Pair elements from both lists at index i\n .collect(Collectors.toList()); // Collect the pairs into a List\n}\n\n// Usage:\nList<String> arr1 = Arrays.asList(\"a\", \"b\", \"c\");\nList<Integer> arr2 = Arrays.asList(1, 2, 3);\nList<List<Object>> zipped = zip(arr1, arr2);\n\nSystem.out.println(zipped); // Output: [[a, 1], [b, 2], [c, 3]]\n"
17+
}
18+
]
19+
},
220
{
321
"name": "Basics",
422
"snippets": [

0 commit comments

Comments
 (0)