-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from 0xHouss/main
Add snippets for Javascript and C
- Loading branch information
Showing
5 changed files
with
154 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[ | ||
{ | ||
"categoryName": "Basics", | ||
"snippets": [ | ||
{ | ||
"title": "Hello, World!", | ||
"description": "Prints Hello, World! to the terminal.", | ||
"code": [ | ||
"#include <stdio.h> // Includes the input/output library", | ||
"", | ||
"int main() { // Defines the main function", | ||
" printf(\"Hello, World!\\n\") // Outputs Hello, World! and a newline", | ||
"", | ||
" return 0; // indicate the program executed successfully", | ||
"}" | ||
], | ||
"tags": ["c", "printing", "hello-world", "utility"], | ||
"author": "0xHouss" | ||
} | ||
] | ||
}, | ||
{ | ||
"categoryName": "Mathematical Functions", | ||
"snippets": [ | ||
{ | ||
"title": "Factorial Function", | ||
"description": "Calculates the factorial of a number.", | ||
"code": [ | ||
"int factorial(int x) {", | ||
" int y = 1;", | ||
"", | ||
" for (int i = 2; i <= x; i++)", | ||
" y *= i;", | ||
"", | ||
" return y;", | ||
"}" | ||
], | ||
"tags": ["c", "math", "factorial", "utility"], | ||
"author": "0xHouss" | ||
}, | ||
{ | ||
"title": "Power Function", | ||
"description": "Calculates the power of a number.", | ||
"code": [ | ||
"int power(int x, int n) {", | ||
" int y = 1;", | ||
"", | ||
" for (int i = 0; i < n; i++)", | ||
" y *= x;", | ||
"", | ||
" return y;", | ||
"}" | ||
], | ||
"tags": ["c", "math", "power", "utility"], | ||
"author": "0xHouss" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.