- Write in simple, plain English. Use short sentences and everyday words.
- Use Oxford commas in inline lists: "a, b, and c" not "a, b, c".
- Do not use em dashes. Restructure the sentence or use a semicolon instead. User emojis scarcely.
- Avoid colons in the middle of sentences. A colon that introduces a code block or a list is fine; existing text is reworded when it is touched anyway, not in a sweep.
- Avoid colorful adjectives and adverbs. Write "adjacency query" not "blazing adjacency query".
- Prefer noun phrases for checklist items over imperative verbs. Write "temp directory teardown" not "tear down the temp directory".
| const std = @import("std"); | |
| const LogMessage = struct { | |
| worker_id: usize, | |
| msg: []const u8, | |
| }; | |
| const LogQueue = struct { | |
| mutex: std.Io.Mutex = .init, | |
| list: std.ArrayListUnmanaged(LogMessage) = .empty, |
| const std = @import("std"); | |
| pub fn main(init: std.process.Init) !void { | |
| const io = init.io; | |
| const cwd = std.Io.Dir.cwd(); | |
| // Create a test file | |
| { | |
| const f = try cwd.createFile(io, "demo.txt", .{}); | |
| defer f.close(io); |
| // This is `file.zig` | |
| // Run: ~/.local/share/zig/0.17.0-dev.56+a8226cd53/zig run file.zig | |
| const std = @import("std"); | |
| pub fn main(init: std.process.Init.Minimal) !void { | |
| // Set up a general-purpose allocator. | |
| var debug_allocator: std.heap.DebugAllocator(.{}) = .init; | |
| defer _ = debug_allocator.deinit(); | |
| const gpa = debug_allocator.allocator(); |
| #!/bin/bash | |
| # Installing Bubblewrap on Debian or Ubuntu | |
| # sudo apt install bubblewrap | |
| # sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
| CLAUDE=$(which claude 2>/dev/null || echo "$HOME/.local/bin/claude") | |
| NODE=$(which node 2>/dev/null) | |
| if [[ ! -f "$CLAUDE" ]]; then |
| default_stages: [ pre-push ] | |
| fail_fast: false | |
| repos: | |
| - repo: https://github.com/pre-commit/pre-commit-hooks | |
| rev: v5.0.0 | |
| hooks: | |
| - id: trailing-whitespace | |
| args: [ --markdown-linebreak-ext=md ] | |
| - id: end-of-file-fixer |
-
Don't write comments based on opinion or gut feeling. Have a reason. If possible, back it up with a reference (style guide, docs, performance data, etc).
-
Write full sentences and don’t leave out context. Be clear so the reader doesn’t have to guess what you mean.
-
Avoid vague "why?" questions. If something is not clear, ask for clarification in a specific way. If something needs changing, suggest the change and explain why.
This is a minimal version of Unity-Dependencies-Hunter in less than 100 lines of code. It scans all assets in the project, checks their dependencies, and lists those that are not referenced by any other asset.
Put it in the Assets/Editor directory and run it from Tools -> Unreferenced Assets Finder.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;Using consistent naming conventions in Unity projects helps keep everything organized and easy to work with. Below is a list of recommended conventions for naming components, scripts, variables, methods, folders, and game objects in a Unity project.
- PascalCase for Classes:
- Use PascalCase for class names (e.g.,
PlayerController,GameManager).
| # This script creates a basic Unity project structure in the current directory. | |
| # To run the script, open a PowerShell terminal and execute the following command: | |
| # .\CreateUnityProjectStructure.ps1 | |
| param( | |
| [string]$BaseDir = (Get-Location).Path | |
| ) | |
| # Function to create a directory and handle errors | |
| function Create-Dir { |