Skip to content

Instantly share code, notes, and snippets.

Fraktality / Zones.lua
Last active October 31, 2023 20:02
Fast trigger volumes
local RunService = game:GetService("RunService")
-- compile an oriented bounding box into a scaled CFrame
local function compileBBox(cframe: CFrame, size: Vector3)
return CFrame.fromMatrix(
matklad /
Created August 21, 2019 09:10
VFS API for Rust
use std::path::Path;
/// VFS provides two benefits over using `fs:
/// * consistent snapshots: reading the same file twice is guranteed to return
/// the same result, unless you explicitly advance the revision of VFS
/// * automated file watching: if you read a file or a dir, you will be notified when the
/// file changes.
struct Vfs {}
evaera / Clean
Last active April 10, 2024 22:49
Best Practices for Clean Code
  1. Use descriptive and obvious names.
    • Don't use abbreviations, use full English words. player is better than plr.
    • Name things as directly as possible. wasCalled is better than hasBeenCalled. notify is better than doNotification.
    • Name booleans as if they are yes or no questions. isFirstRun is better than firstRun.
    • Name functions using verb forms: increment is better than plusOne. unzip is better than filesFromZip.
    • Name event handlers to express when they run. onClick is better than click.
    • Put statements and expressions in positive form.
      • isFlying instead of isNotFlying. late intead of notOnTime.
      • Lead with positive conditionals. Avoid if not something then ... else ... end.
  • If we only care about the inverse of a variable, turn it into a positive name. missingValue instead of not hasValue.
local Spring = {} do
Spring.__index = Spring
local pi = math.pi
local exp = math.exp
local sin = math.sin
local cos = math.cos
local sqrt = math.sqrt
function, frequency, position)
// paste in your console
speechSynthesis.onvoiceschanged = function() {
var msg = new SpeechSynthesisUtterance();
msg.voice = this.getVoices().filter(v => == 'Cellos')[0];
msg.text = Object.keys(window).join(' ');

Casual Raiding and Deliberate Learning

Note: I wrote this in 2015 when I was raiding with a casual guild in WoW.

de·lib·er·ate (adj.)

  • done consciously and intentionally: a deliberate attempt to provoke conflict.

  • fully considered; not impulsive: a deliberate decision.

    synonyms: intentional, calculated, conscious, intended, purposeful

KdotJPG /
Last active February 9, 2024 03:42
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
josefnpat / gist:9679636
Created March 21, 2014 04:41
Simple synth
-- public domain
-- author: LPGhatguy
local default_samples = 48000
local pitch_rate = 2^(1 / 12)
local function round(n)
return math.floor(n + 0.5)
willurd /
Last active April 10, 2024 19:00
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
jrus / lua-uuid.lua
Created July 29, 2012 09:26
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)