Skip to content

Instantly share code, notes, and snippets.

View zephraph's full-sized avatar

Justin Bennett zephraph

View GitHub Profile
@ityonemo
ityonemo / test.md
Last active May 31, 2024 07:15
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

(defn point-outside-circle [c r p]
(if (< (vec2/dist c p) r)
(vec2/scale (vec2/normalize (vec2/- p c)) r)
p))
(defn circle-tangent-point [c r b dir]
(let [B (point-outside-circle c r b)
cB (vec2/dist c B)
S (vec2/scale (vec2/normalize (vec2/- B c)) r)
@ichizok
ichizok / deno.patch
Last active May 31, 2024 06:46
for Solaris/illumos
diff --git a/.cargo/config.toml b/.cargo/config.toml
index f5b2f124b..6cd093e8e 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -23,6 +23,9 @@ rustflags = [
"link-args=-fuse-ld=lld -weak_framework Metal -weak_framework MetalPerformanceShaders -weak_framework QuartzCore -weak_framework CoreGraphics",
]
+[target.x86_64-unknown-illumos]
+rustflags = ["-C", "link-args=-latomic -lffi -lstdc++"]
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'