Skip to content

Instantly share code, notes, and snippets.

View Sleitnick's full-sized avatar

Stephen Leitnick Sleitnick

View GitHub Profile
--!native
--!strict
-- Source of calculations: https://gml.noaa.gov/grad/solcalc/calcdetails.html
export type SolarData = {
JulianDay: number,
JulianCentury: number,
GeometricMeanLongitudeSunDeg: number,
GeometricMeanAnomSunDeg: number,
--!strict
local function find(parent: Instance, ...: string): Instance
local instance = parent
for i = 1, select("#", ...) do
local name = (select(i, ...))
local inst = instance:FindFirstChild(name)
if inst == nil then
error(`failed to find instance "{name}" in {instance:GetFullName()}`, 2)
@Sleitnick
Sleitnick / ConvertToStringRequires.luau
Created June 8, 2025 16:07
Take instance-require lines and convert them to string-require lines
-- Add lines to here & run script
local lines = [[
local Roact = require(script.Parent.Parent.Parent.Packages.Roact)
local RoactRodux = require(script.Parent.Parent.Parent.Packages.RoactRodux)
local Constants = require(script.Parent.Parent.Plugin.Constants)
local ThemeContext = require(script.Parent.ThemeContext)
]]
-- e.g. output from above:
--[[
@Sleitnick
Sleitnick / observers.luau
Created November 2, 2025 16:12
Observer Test
--!strict
-- NOTE: This is an early prototype. It is incredibly messy. It's probably buggy too.
-- There is a lot of code duplication and weird type-casting. Just making it work.
-- There are a lot of things that I need/want to change. It is not ready for production.
local CollectionService = game:GetService("CollectionService")
type InstanceContext = {
Type: "instance",
--!strict
local ScriptEditorService = game:GetService("ScriptEditorService")
type Request = {
position: {
line: number,
character: number,
},
textDocument: {
@Sleitnick
Sleitnick / GenerateServicesTable.luau
Last active June 13, 2026 05:03
GenerateServicesTable.luau
-- Run this script in the command bar. It will generate a table of services that
-- are relevant to Roblox game devs, e.g. it has permitted methods/properties/events.
const ReflectionService = game:GetService("ReflectionService")
const start = os.clock()
const classes = ReflectionService:GetClasses()
const services: { string } = {}
const filtered: { string } = {}