Skip to content

Instantly share code, notes, and snippets.

From Zigling 058.

//                          u8  single item
//                         *u8  single-item pointer
//                        []u8  slice (size known at runtime)
//                       [5]u8  array of 5 u8s
//                       [*]u8  many-item pointer (zero or more)
//                 enum {a, b}  set of unique values a and b
//                error {e, f}  set of unique error values e and f
@raohmaru
raohmaru / requestAnimationFrame.js
Last active January 28, 2024 19:04
requestAnimationFrame() in node.js
const callbacks = [];
const fpsInterval = 1000 / 60;
let time = performance.now();
function requestAnimationFrameLoop() {
const now = performance.now();
const delta = now - time;
if (delta >= fpsInterval) {
// Adjust next execution time in case this loop took longer to execute
time = now - (delta % fpsInterval);
@artokun
artokun / Hierarchy.txt
Last active June 16, 2024 12:02
Godot 4 3D RTS Camera Controller
World (Node3D)
|- RTSController (Node3D)
|- Elevation (Node3D)
|- MainCamera (Camera3D)
@mccutchen
mccutchen / .envrc
Created November 3, 2022 14:06
Example direnv .envrc for Python projects that manages a local virtualenv that updates automatically when requirements.txt changes
#!/bin/bash
VENV_DIR=".venv"
REQUIREMENTS_HASH_FILE="$VENV_DIR/requirements.shasum"
REQUIREMENTS_HASH_FUNC="shasum"
REQUIREMENTS_HASH_VAL=$($REQUIREMENTS_HASH_FUNC requirements.txt | cut -d ' ' -f 1)
function reset_venv() {
rm -rf "$VENV_DIR"
@DGriffin91
DGriffin91 / main.rs
Last active March 5, 2024 08:11
Bevy Combine Meshes with Transforms
// License: Apache-2.0 / MIT
// Combine multiple meshes in Bevy with Transforms
// Adapted from https://github.com/bevyengine/bevy/blob/main/examples/3d/3d_shapes.rs
use std::f32::consts::PI;
use bevy::{
math::Vec4Swizzles,
prelude::*,
render::{
@koakh
koakh / gist:fbbc37cde630bedcf57acfd4d6a6956b
Last active April 6, 2024 02:04
SurrealDB : How to use signin and signup (server + client nodesjs)
**As a developer you have complete control over the signup and signin functionality...**
```shell
$ surreal sql --conn http://localhost:8000 --user root --pass root --ns test --db test
```
```sql
-- optional : this is the default see --ns test --db test start server flags
-- USE NS test DB test;
@raysan5
raysan5 / raylib_vs_sdl.md
Last active June 23, 2024 11:07
raylib vs SDL - A libraries comparison

raylib_vs_sdl

In the last years I've been asked multiple times about the comparison between raylib and SDL libraries. Unfortunately, my experience with SDL was quite limited so I couldn't provide a good comparison. In the last two years I've learned about SDL and used it to teach at University so I feel that now I can provide a good comparison between both.

Hope it helps future users to better understand this two libraries internals and functionality.

Table of Content

@jdmichaud
jdmichaud / 1-zig-cheatsheet
Last active May 1, 2024 07:17
Zig cheatsheet
https://ziglang.org/documentation/master/#Pointers
*T - single-item pointer to exactly one item.
Supports deref syntax: ptr.*
[*]T - pointer to unknown number of items. (eq. of *T in C)
Supports index syntax: ptr[i]
Supports slice syntax: ptr[start..end]
Supports pointer arithmetic: ptr + x, ptr - x
@sts10
sts10 / rust-command-line-utilities.markdown
Last active June 27, 2024 11:24
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
// TEMPORARY TEST FILE TO DELETE!
/* HOW IT WORKS:
........_______________.
APP -> | SECURE RENDER | <-> DATA
........---------------.
The app ONLY feeds *in* view logic.
Secure Render NEVER sends back or up.
*/
;(function(){
var i = document.createElement('iframe');