Skip to content

Instantly share code, notes, and snippets.

@Corecii
Corecii / OnDestroyed.lua
Last active August 30, 2020 18:18
Roblox Instance Destroyed and Garbage Collected Example Code
--[[
Notable behavior:
* ObjectValues will get their Value set to nil if:
* The ObjectValue is in nil
* its Value is in nil
* its Value gets garbage collected because it has no string reference
* When an object gets garbage collected, all of its connections get disconnected.
* Connections that don't hold a reference to the object won't prevent garbage collection!!
* When an object gets destroyed, connections are disconnected by the next Heartbeat
@Corecii
Corecii / idea_methods_with_self.lua
Created February 17, 2021 03:35
Promise- and callback-heavy code relies on passing objects around a lot, and having to enclose objects in callbacks is annoying. What if we could *almost* do `object:method` to reference a version of the method that includes the object?
local withMeta = {}
function withMeta:__index(key)
local object = self._with
return function(...)
return object[key](object, ...)
end
end
local function with(object)
@Corecii
Corecii / README.md
Last active September 22, 2024 16:28
Sample GitHub Actions file for running Roblox tests while connected to a WireGuard server

Sample Roblox Tests with WireGuard GitHub Actions File

Roblox changed their login behavior such that login cookies are tied to IP address. This prevents Roblox from working will with GitHub actions, as GitHub actions runners don't always use the same IP.

This action file connects to a WireGuard server first such that the action runner's IP appears to be the WireGuard server's. You can connect to the WireGuard server yourself to generate a login cookie so that the login IP is consistent between the original login and the action runners.

Server Setup

@Corecii
Corecii / formatting.md
Last active May 20, 2022 04:42
Steam Deck SD Card formatting

How to format micro SD card for Steam Deck manually

The Steam Deck seems to cause irreparable issues when it formats an SD card twice.

In hopes of avoiding those issues, I'va manually formatted the SD card. I haven't confirmed if this avoids the "issues when formatted twice" because that would mean potentially breaking the expensive SD card!

Steps