Skip to content

Instantly share code, notes, and snippets.

View MaximumADHD's full-sized avatar

Max MaximumADHD

View GitHub Profile
@EgoMoose
EgoMoose / ViewportModel.lua
Last active September 7, 2024 18:54
Lua class to calculate camera distance/cframe for fitting models into viewport frames
--[[
MIT License
Copyright (c) 2021 EgoMoose
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@jovannic
jovannic / MockTree.lua
Last active November 26, 2020 02:44
MockTree: A module for handling Welds and Motor6Ds outside of Workspace
local MockTree = {}
local function addJointEdge(joints, joint, me, other)
local edgeList = joints[me]
if not edgeList then
edgeList = {}
joints[me] = edgeList
end
table.insert(edgeList, {joint, other})
end
@MikuAuahDark
MikuAuahDark / .lua
Created December 17, 2018 12:07
32-bit unsigned integer multiplication in Lua
function dwordMultiply(a, b)
a = a % 4294967296
b = b % 4294967296
local ah, al = math.floor(a / 65536), a % 65536
local bh, bl = math.floor(b / 65536), b % 65536
local high = ((ah * bl) + (al * bh)) % 65536
return ((high * 65536) + (al * bl)) % 4294967296
end
-- this is an old version
-- see: https://github.com/Reselim/Base64
local FILLER_CHARACTER = 61
local alphabet = {}
local indexes = {}
for index = 65, 90 do table.insert(alphabet, index) end -- A-Z
for index = 97, 122 do table.insert(alphabet, index) end -- a-z