Skip to content

Instantly share code, notes, and snippets.

View howmanysmall's full-sized avatar
😎
pobam L+

howmanysmall

😎
pobam L+
  • Utah
View GitHub Profile
--- Octree implementation
-- @classmod Octree
-- i see no god up here
-- EXCEPT FOR ME
local OctreeNode = require(script.OctreeNode)
local OctreeRegionUtils = require(script.OctreeRegionUtils)
local EPSILON = 1e-9
@howmanysmall
howmanysmall / janitor.spec.lua
Last active April 1, 2021 02:11
fuck you ethan here's your damn unit test
return function()
local JanitorThread = require(script.Parent)
describe("janitr", function()
it("should be cool", function()
local Janitor = JanitorThread.new()
Janitor:Add(Instance.new("Part"), "Destroy", "Part").Parent = workspace
local c = Janitor:Add(workspace.ChildAdded:Connect(print), "Disconnect")
expect(typeof(Janitor:Get("Part"))).to.equal("Instance")
--[[
class Spring
Description:
A physical model of a spring, useful in many applications. Properties only evaluate
upon index making this model good for lazy applications
API:
Spring = Spring.new(number position)
Creates a new spring in 1D
local ENABLE_TRACEBACK = true
local FastSignal = {ClassName = "FastSignal"}
FastSignal.__index = FastSignal
--[[**
Creates a new FastSignal object.
@returns [FastSignal]
**--]]
function FastSignal.new()
local Math = {}
function Math:__index(Index)
if Math[Index] then
return Math[Index]
end
end
function Math.new()
return setmetatable({}, Math)
end
@howmanysmall
howmanysmall / Janitor.lua
Last active February 15, 2021 13:15
New repo: https://github.com/howmanysmall/Janitor If you don't use Promise, use Janitor.lua, if you use Promise, use JanitorWithPromiseSupport.lua. Now with support for roblox-ts at https://www.npmjs.com/package/@rbxts/janitor
--!nocheck
-- Janitor
-- Original by Validark
-- Modifications by pobammer
-- roblox-ts support by OverHash and Validark
local RunService = game:GetService("RunService")
local Heartbeat = RunService.Heartbeat
local Janitors = setmetatable({}, {__mode = "k"})
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local CatchFactory = require("CatchFactory")
local Constants = require("Constants")
local GroupPromise = require("GroupPromise")
local Promise = require("Promise")
local PromiseChild = require("PromiseChild") -- Basically Promisified WaitForChild
local bit_lshift = require("bit").lshift
local math_floor = math.floor
local math_log = math.log
local SIZE_THRESHOLD = 16
local function Partition(Array, Low, High, Value, Comparison)
if Comparison then
local Index = Low
local Jndex = High
local function GetBoundingBox(model, orientation)
if typeof(model) == "Instance" then
model = model:GetDescendants()
end
if not orientation then
orientation = CFrame.new()
end
local inf = math.huge
local minx, miny, minz = inf, inf, inf
local meth = {}
-- Go awat
function Math.Awesome()
return "awesome"
end
function Math.add1and 2()
return 1 + 2
end