Skip to content

Commit 34a7088

Browse files
Updating all snippets to new guidelines
1 parent 95ef30f commit 34a7088

File tree

215 files changed

+406
-946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+406
-946
lines changed

snippets/c/basics/hello-world.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Hello, World!
33
description: Prints Hello, World! to the terminal.
44
author: 0xHouss
5-
tags: c,printing,hello-world,utility
5+
tags: printing,hello-world
66
---
77

88
```c

snippets/c/mathematical-functions/factorial-function.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Factorial Function
33
description: Calculates the factorial of a number.
44
author: 0xHouss
5-
tags: c,math,factorial,utility
5+
tags: math,factorial
66
---
77

88
```c
@@ -14,4 +14,7 @@ int factorial(int x) {
1414

1515
return y;
1616
}
17+
18+
// Usage:
19+
factorial(4); // Returns: 24
1720
```

snippets/c/mathematical-functions/power-function.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

snippets/cpp/basics/hello-world.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Hello, World!
33
description: Prints Hello, World! to the terminal.
44
author: James-Beans
5-
tags: cpp,printing,hello-world,utility
5+
tags: printing,hello-world
66
---
77

88
```cpp

snippets/cpp/data-structure-conversion/vector-to-queue.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Vector to Queue
33
description: Convert vector into queue quickly
4-
tags: cpp, data structures,queue,vector
4+
tags: data structures,queue,vector
55
author: mrityunjay2003
66
---
77

@@ -13,4 +13,7 @@ author: mrityunjay2003
1313
std::queue<int> vectorToQueue(const std::vector<int>& v) {
1414
return std::queue<int>(std::deque<int>(v.begin(), v.end()));
1515
}
16-
```
16+
17+
std::vector<int> vec = { 1, 2, 3, 4, 5 };
18+
vectorToQueue(&vec); // Returns: std::queue<int> { 1, 2, 3, 4, 5 }
19+
```
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Check Prime Number
33
description: Check if an integer is a prime number
4-
tags: cpp, number, prime
4+
tags: number, prime
55
author: MihneaMoso
66
---
77

@@ -16,11 +16,6 @@ bool is_prime(int n) {
1616
return true;
1717
}
1818

19-
// Usage
20-
#include <iostream>
21-
22-
int main() {
23-
std::cout << is_prime(29) << std::endl; // Output: 1
24-
return 0;
25-
}
19+
// Usage:
20+
is_prime(29); // Returns: true
2621
```

snippets/cpp/string-manipulation/reverse-string.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Reverse String
33
description: Reverses the characters in a string.
44
author: Vaibhav-kesarwani
5-
tags: cpp,array,reverse,utility
5+
tags: array,reverse
66
---
77

88
```cpp
@@ -14,4 +14,6 @@ std::string reverseString(const std::string& input) {
1414
std::reverse(reversed.begin(), reversed.end());
1515
return reversed;
1616
}
17+
18+
reverseString("quicksnip"); // Returns: "pinskciuq"
1719
```

snippets/cpp/string-manipulation/split-string.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Split String
33
description: Splits a string by a delimiter
44
author: saminjay
5-
tags: cpp,string,split,utility
5+
tags: string,split
66
---
77

88
```cpp
@@ -20,4 +20,7 @@ std::vector<std::string> split_string(std::string str, std::string delim) {
2020
}
2121
return splits;
2222
}
23+
24+
// Usage:
25+
split_string("quick_-snip", "_-"); // Returns: std::vector<std::string> { "quick", "snip" }
2326
```

snippets/csharp/basics/hello-world.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Hello, World!
33
description: Prints Hello, World! to the terminal.
44
author: chaitanya-jvnm
5-
tags: c#,printing,hello-world,utility
5+
tags: printing,hello-world
66
---
77

8-
```c#
8+
```csharp
99
public class Program {
1010
public static void Main(string[] args) {
1111
System.Console.WriteLine("Hello, World!");
1212
}
1313
}
14-
```
14+
```

snippets/csharp/guid-utilities/generate-guid.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
title: Generate GUID
33
description: Generates a new GUID
44
author: chaitanya-jvnm
5-
tags: c#,guid,generate,utility
5+
tags: guid,generate
66
---
77

8-
```c#
8+
```csharp
99
public static string GenerateGuid() {
1010
return Guid.NewGuid().ToString();
1111
}
12-
```
12+
13+
// Usage:
14+
GenerateGuid(); // Returns: 1c4c38d8-64e4-431b-884a-c6eec2ab02cd (Uuid is random)
15+
```

0 commit comments

Comments
 (0)