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

added nob.h support to quicksnip under new C category #266

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

Closed
james-beans wants to merge 2 commits into quicksnip-dev:main from james-beans:main
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"dev:serve": "vite dev",
"build": "tsc -b && vite build",
"lint": "eslint .",
"format": "prettier --write .",
Expand Down
46 changes: 46 additions & 0 deletions snippets/c/[nob]/basics/basic-config.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Basic Config
description: The basic builder for C projects using the nob.h library (https://github.com/tsoding/nob.h).
author: James-Beans
tags: builder,basic,config
---

```c
// You can make a new nob-h project using one of these commands:
// npx create-nobuild@latest
// yarn create nobuild
// pnpm create nobuild@latest

// This would be the nob.c config file.

#define NOB_IMPLEMENTATION

// The nob.h library has to be in the same folder as nob.c (this file).
#include "nob.h"

#define BUILD_FOLDER "build/"
#define SRC_FOLDER "src/"

int main(int argc, char **argv)
{
// This self-rebuild mechanism checks if nob.c was modified
// If you’ve updated the build script, remove the existing binary to force a rebuild
NOB_GO_REBUILD_URSELF(argc, argv);

Nob_Cmd cmd = {0};

if (!nob_mkdir_if_not_exists(BUILD_FOLDER)) return 1;

#ifdef _WIN32
// On Windows, use clang.exe with Unix flags because of mingw64 providing clang
nob_cmd_append(&cmd, "clang", "-Wall", "-Wextra", "-o", BUILD_FOLDER "main", SRC_FOLDER "main.c");
#else
// On non-Windows platforms, use cc with the typical Unix flags
nob_cmd_append(&cmd, "cc", "-Wall", "-Wextra", "-o", BUILD_FOLDER "main", SRC_FOLDER "main.c");
#endif

if (!nob_cmd_run_sync(cmd)) return 1;

return 0;
}
```
41 changes: 41 additions & 0 deletions snippets/c/[nob]/flags/wayland-config.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Wayland Config
description: The nob.h builder but with Wayland flags.
author: James-Beans
tags: builder,config,Wayland,Linux
---

```c
// You can make a new nob-h project using one of these commands:
// npx create-nobuild@latest
// yarn create nobuild
// pnpm create nobuild@latest

// This would be the nob.c config file.

// This will only work for Linux because it uses Wayland. And that is Linux only.

#define NOB_IMPLEMENTATION

// The nob.h library has to be in the same folder as nob.c (this file).
#include "nob.h"

#define BUILD_FOLDER "build/"
#define SRC_FOLDER "src/"
#define FLAGS "-lwayland-client"

int main(int argc, char **argv)
{
// This self-rebuild mechanism checks if nob.c was modified
// If you’ve updated the build script, remove the existing binary to force a rebuild
NOB_GO_REBUILD_URSELF(argc, argv);

Nob_Cmd cmd = {0};

if (!nob_mkdir_if_not_exists(BUILD_FOLDER)) return 1;
nob_cmd_append(&cmd, "cc", "-Wall", "-Wextra", "-o", BUILD_FOLDER"main", SRC_FOLDER"main.c", FLAGS);
if (!nob_cmd_run_sync(cmd)) return 1;

return 0;
}
```
41 changes: 41 additions & 0 deletions snippets/c/[nob]/flags/x11-config.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: X11 Config
description: The nob.h builder but with X11 flags.
author: James-Beans
tags: builder,config,X11,Linux
---

```c
// You can make a new nob-h project using one of these commands:
// npx create-nobuild@latest
// yarn create nobuild
// pnpm create nobuild@latest

// This would be the nob.c config file.

// This will only work for Linux because it uses X11. And that is Linux only.

#define NOB_IMPLEMENTATION

// The nob.h library has to be in the same folder as nob.c (this file).
#include "nob.h"

#define BUILD_FOLDER "build/"
#define SRC_FOLDER "src/"
#define FLAGS "-lX11"

int main(int argc, char **argv)
{
// This self-rebuild mechanism checks if nob.c was modified
// If you’ve updated the build script, remove the existing binary to force a rebuild
NOB_GO_REBUILD_URSELF(argc, argv);

Nob_Cmd cmd = {0};

if (!nob_mkdir_if_not_exists(BUILD_FOLDER)) return 1;
nob_cmd_append(&cmd, "cc", "-Wall", "-Wextra", "-o", BUILD_FOLDER"main", SRC_FOLDER"main.c", FLAGS);
if (!nob_cmd_run_sync(cmd)) return 1;

return 0;
}
```
1 change: 1 addition & 0 deletions snippets/c/[nob]/icon.svg
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]

AltStyle によって変換されたページ (->オリジナル) /