You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/consolidated/javascript.json
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -364,6 +364,22 @@
364
364
}
365
365
]
366
366
},
367
+
{
368
+
"categoryName": "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"
"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"
description: Calculates the largest positive integer that divides each of the integers without leaving a remainder. Useful for calculating aspect ratios.
0 commit comments