Skip to content

Instantly share code, notes, and snippets.

View naranyala's full-sized avatar

naranyala naranyala

View GitHub Profile
@naranyala
naranyala / car_obstacles_game_reactive.nim
Last active July 28, 2025 16:24
2D car obstacles game using nim programming and raylib (reactive style)
import raylib as rl
import random
import math
import asyncdispatch
import strutils
import sequtils
# Game constants
const
ScreenWidth = 800
@naranyala
naranyala / car_obstacles_game_imperative.nim
Last active July 28, 2025 16:24
2D car obstacles game using nim programming and raylib (imperative style)
import raylib as rl
import random
import math
# Game constants
const
ScreenWidth = 800
ScreenHeight = 600
PlayerWidth = 50
PlayerHeight = 80
@naranyala
naranyala / system_pkglogs.nim
Created July 27, 2025 06:27
log your system packages into txt files regularly
import os, strformat, times, strutils, osproc, tables
let logDir = getHomeDir() / "package-logs"
let timestamp = now().format("yyyyMMdd'_'HHmmss")
createDir(logDir)
proc logPackages(manager, cmd: string) =
let logFile = logDir / fmt"{manager}-{timestamp}.txt"
echo fmt"📦 Logging {manager} packages..."
@naranyala
naranyala / sliding_up_drawer.nim
Last active July 26, 2025 23:55
for the community, a sliding-up drawer (bottom sheets) with backdrop using nim and raylib
import raylib as rl
# === Reactive System with Explicit Type Safety ===
type
ObservableWatcher = proc(): void {.closure.}
Observable*[T] = ref object
value*: T
watchers: seq[ObservableWatcher]
proc newObservable*[T](initialValue: T): Observable[T] =
import raylib
import strformat
type
ReactiveCallback[T] = object
callback: proc(value: T, ctx: pointer)
ctx: pointer
Reactive[T] = ref object
value: T
@naranyala
naranyala / getter_setter_example.odin
Last active July 26, 2025 14:27
for the community, a getter and setter implementation in odin programming
package main
import "core:fmt"
Person :: struct {
name: string
}
// Getter and setter procedures
@naranyala
naranyala / raylib_modal_dialog_example.odin
Last active July 22, 2025 17:46
for the community, a modal dialog implementation of raylib using odin programming
package main
import "core:fmt"
import "core:strings"
import rl "vendor:raylib"
// Package-level variable for animation state
scale: f32 = 0
ui_modal :: proc(
@naranyala
naranyala / dashboard_layout.odin
Created July 21, 2025 15:22
for the community, a dashboard layout made with odin programming
package main
import "core:fmt"
import "core:strings"
import rl "vendor:raylib"
// Configuration constants
SCREEN_WIDTH :: 1280
SCREEN_HEIGHT :: 720
TOGGLE_KEY :: rl.KeyboardKey.F1
#!/usr/bin/env bash
set -euo pipefail
### 🧠 What This Covers
# | Library | Purpose |
# |-------------|---------------------------------------|
# | `mesa-utils`| Tools like `glxinfo`, `glxgears` |
# | `GL`, `GLU` | Core OpenGL and utility functions |
#!/usr/bin/env bash
set -euo pipefail
# Respect XDG spec or fallback to defaults
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/nvim"
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/nvim"
DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/nvim"
echo "🧹 Cleaning Neovim directories..."
for dir in "$CACHE_DIR" "$STATE_DIR" "$DATA_DIR"; do