diff --git a/public/consolidated/cpp.json b/public/consolidated/cpp.json index 75698cc0..fd38de1b 100644 --- a/public/consolidated/cpp.json +++ b/public/consolidated/cpp.json @@ -33,6 +33,7 @@ ] }, { + "categoryName": "Debuging", "name": "Debugging", "snippets": [ { diff --git a/public/consolidated/scss.json b/public/consolidated/scss.json index f64d083b..4963e39b 100644 --- a/public/consolidated/scss.json +++ b/public/consolidated/scss.json @@ -156,6 +156,19 @@ "contributors": [], "code": "@mixin line-clamp($number) {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: $number;\n overflow: hidden;\n}\n" }, + { + "title": "PX to REM Helper", + "description": "This function will convert px values to rem values.", + "author": "gihanrangana", + "tags": [ + "function", + "pixel", + "rem", + "px-to-rem" + ], + "contributors": [], + "code": "@function px-to-rem($px, $base: 16px) {\n @return ($px / $base) * 1rem;\n}\n\n// Usage:\ndiv {\n font-size: px-to-rem(12px); // Output: 0.75rem\n padding: px-to-rem(16px); // Output: 1rem\n margin: px-to-rem(32px) // Output 2rem\n}\n" + }, { "title": "Text Gradient", "description": "Adds a gradient color effect to text.", diff --git a/snippets/cpp/debuging/vector-print.md b/snippets/cpp/debuging/vector-print.md new file mode 100644 index 00000000..9fe8550b --- /dev/null +++ b/snippets/cpp/debuging/vector-print.md @@ -0,0 +1,29 @@ +--- +title: Vector Print +description: Overloads the << operator to print the contents of a vector just like in python. +author: Mohamed-faaris +tags: printing,debuging,vector +--- + +```cpp +#include +#include + +template +std::ostream& operator<<(std::ostream& os, const std::vector& vec) { + os << "["; + for (size_t i = 0; i < vec.size(); ++i) { + os << vec[i]; // Print each vector element + if (i != vec.size() - 1) { + os << ", "; // Add separator + } + } + os << "]"; + return os; // Return the stream +} + +// Usage: +std::vector numbers = {1, 2, 3, 4, 5}; +std::cout << numbers << std::endl; // Outputs: [1, 2, 3, 4, 5] + +``` diff --git a/snippets/scss/typography/px-to-rem-helper.md b/snippets/scss/typography/px-to-rem-helper.md new file mode 100644 index 00000000..17e154d0 --- /dev/null +++ b/snippets/scss/typography/px-to-rem-helper.md @@ -0,0 +1,19 @@ +--- +title: PX to REM Helper +description: This function will convert px values to rem values. +author: gihanrangana +tags: function,pixel,rem,px-to-rem +--- + +```scss +@function px-to-rem($px, $base: 16px) { + @return ($px / $base) * 1rem; +} + +// Usage: +div { + font-size: px-to-rem(12px); // Output: 0.75rem + padding: px-to-rem(16px); // Output: 1rem + margin: px-to-rem(32px) // Output 2rem +} +``` \ No newline at end of file