Skip to content

Instantly share code, notes, and snippets.

View Quenty's full-sized avatar
🎉
Follow me on Twitter @Quenty

James Onnen Quenty

🎉
Follow me on Twitter @Quenty
View GitHub Profile
@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
---
-- @classmod CameraChallenge
-- @author Quenty
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
-- Challenge:
-- 1. Make `camera' always point to the the current or last known camera.
-- a. Problem: CurrentCamera can be nil.
-- b. Guarantee that `camera' is never nil.
---
-- @module WaveCollapseUtils
-- @author Quenty
local WaveCollapseUtils = {}
local EDGE_DATA = {
{
2, -- Edge index (forward)
1, -- Neighbor's edgeindex (backward)
local Roact = require("Roact")
local Segments = {}
for index = 1, 8 do
local X = (index - 1) % 4
local Y = math.floor((index - 1) / 4)
table.insert(Segments, {
Angle = 360 / (2 ^ index),
@Anaminus
Anaminus / Signal.lua
Last active September 29, 2020 01:33
--[[
# Signal
API-compatible Roblox events.
Addresses two flaws in previous implementations:
- Held a reference to the last set of fired arguments.
- Arguments would be overridden if the signal was fired by a listener.
@zeux
zeux / edge-encode.cpp
Last active December 8, 2018 06:25
8-bit (unsigned) floating point encoding that is designed to be very efficient to decode on DX9/GLES2 class GPUs
// Can be used to efficiently encode floating point values from a limited range ([0..65k]) into a byte
// edgeDecode is optimized for GPUs (native exp2)
// edgeEncode1 is optimized for GPUs (native log2)
// edgeEncode2 is optimized for CPUs but is an approximation
// edgeEncode3 is optimized for CPUs
float edgeDecode(int e)
{
return exp2f(float(e) * (1 / 16.f)) - 1;
}
@badcc
badcc / ChangeClassName.lua
Last active September 13, 2024 17:53
Change ClassName of Roblox instance (using Anaminus' API dump)
local ClassName = 'TextButton'
local Object = game.Selection:Get()[1]
local HttpService = game:GetService('HttpService')
local API = HttpService:JSONDecode(HttpService:GetAsync('http://anaminus.github.io/rbx/json/api/latest.json'))
local function ChangeClass(ClassName, Object, NewObject)
for _,v in next,API do
if (v['type'] == 'Class' and v['Name'] == ClassName and v['Superclass']) then
ChangeClass(v['Superclass'], Object, NewObject)
elseif (v['type'] == 'Property' and v['Class'] == ClassName) then
pcall(function() -- If property is not allowed to be changed, do not error.
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <memory>
#include <future>
#include <stdio.h>
#include <assert.h>
#include <time.h>
#include <stdint.h>
anonymous
anonymous / Functions2.md
Created September 18, 2015 15:58
auto-posted gist

Functions: Passing By Value vs Passing by Reference

  • Motivating Demonstration: swap.c

Pointers in C

int a = 10;
@Anaminus
Anaminus / splash-patch.lua
Created March 12, 2015 06:14
Replaces Roblox Studio's splash screen with another image.
-- Replaces Roblox Studio's splash screen with another image.
--
-- Usage:
--
-- lua splash-patch.lua [STUDIO_PATH] [IMAGE_PATH]
--
-- Specifying no options prompts for input.
-- First KB of original splash image file