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

[Snippet] SASS function to convert px to rem #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Mathys-Gasnier merged 13 commits into quicksnip-dev:main from gihanrangana:px-to-rem
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
19c9437
Update consolidated snippets
actions-user Jan 2, 2025
0e08ae1
Merge branch 'dostonnabotov:main' into main
gihanrangana Jan 2, 2025
73cbecb
Create auto-sync.yml
gihanrangana Jan 2, 2025
84c58ac
Function to convert px to rem
gihanrangana Jan 4, 2025
9e89a9c
Update consolidated snippets
actions-user Jan 4, 2025
c76d2fc
Merge branch 'dostonnabotov:main' into main
gihanrangana Jan 4, 2025
203a818
update title
gihanrangana Jan 4, 2025
80e5129
Update consolidated snippets
actions-user Jan 4, 2025
59a44e6
updated the requested changes
gihanrangana Jan 5, 2025
bd4f369
Update consolidated snippets
actions-user Jan 5, 2025
14986ee
Merge branch `dostonnabotov:main` into px-to-rem
gihanrangana Jan 5, 2025
92f1f4f
Update consolidated snippets
actions-user Jan 5, 2025
b8f2607
Merge branch 'main' into px-to-rem
gihanrangana Jan 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions public/consolidated/cpp.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@
}
]
},
{
"categoryName": "Debugging",
"snippets": [
{
"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"
],
"contributors": [],
"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"
}
]
},
{
"categoryName": "Debuging",
"snippets": [
Expand Down
13 changes: 13 additions & 0 deletions public/consolidated/scss.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
29 changes: 29 additions & 0 deletions snippets/cpp/debuging/vector-print.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <vector>

template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& 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<int> numbers = {1, 2, 3, 4, 5};
std::cout << numbers << std::endl; // Outputs: [1, 2, 3, 4, 5]

```
19 changes: 19 additions & 0 deletions snippets/scss/typography/px-to-rem-helper.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -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
}
```

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /