Skip to content

Instantly share code, notes, and snippets.

@g-simmons
g-simmons / typst-playing-cards.typ
Created October 29, 2023 20:37
Simple playing cards in typst
#let card(cardname) = {
let (card, suit) = cardname.split(" of ")
let suits = (
"hearts": sym.suit.heart,
"diamonds": sym.suit.diamond,
"clubs": sym.suit.club,
"spades": sym.suit.spade,
)
let suit_colors = (
"hearts": "red",
@dwilliamson
dwilliamson / MarchingCubes.js
Last active May 9, 2025 00:46
Marching Cubes Lookup Tables
//
// Lookup Tables for Marching Cubes
//
// These tables differ from the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm)
//
// The co-ordinate system has the more convenient properties:
//
// i = cube index [0, 7]
// x = (i & 1) >> 0
// y = (i & 2) >> 1
@jnguyen1098
jnguyen1098 / bogograms.c
Created March 30, 2021 04:12
Find out if two words are anagrams, bogo style
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
int main(void)
{
char first_word[BUFSIZ] = "";
char second_word[BUFSIZ] = "";
@FreyaHolmer
FreyaHolmer / FlyCamera.cs
Last active April 24, 2025 21:16
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable