Skip to content

Instantly share code, notes, and snippets.

@cxmeel
cxmeel / RobloxFonts.lua
Last active November 2, 2023 22:28
An almost complete list of Fonts available locally and via Roblox cloud fonts.
--!strict
export type IFont = {
AssetId: string,
Name: string,
Aliases: { string },
Weights: { Enum.FontWeight },
Styles: { Enum.FontStyle },
}
local fonts: { IFont } = {
@cxmeel
cxmeel / README.md
Last active October 14, 2023 14:58
JavaScript Snippets

A collection of JavaScript snippets, mostly used in custom UserScripts. You can paste them into your code directly, or @require them using the GitHub raw link.

// equivalent to `const container = document.querySelector("div.container")`
const container = $("div.container")
@cxmeel
cxmeel / README.md
Last active May 29, 2023 07:09
A small utility module for creating React/Roact components with default props.

This has been replaced with default-props. See the project page here:

https://github.com/csqrl/default-props

withDefaultProps

A small utility module for creating React/Roact components with default props.

Setup for Roact

@cxmeel
cxmeel / semver.lua
Last active May 23, 2023 11:25
Basic semver string library implemented in Luau.
--!strict
--[[
Provides a set of functions for comparing semver strings.
See https://semver.org/ for more information.
Types:
type SemverRecord = {
major: number,
minor: number,
patch: number,
@cxmeel
cxmeel / 01.README.md
Last active December 2, 2023 13:34
Hover cards for the Roblox website.

A custom fetch/GM_xmlhttpRequest wrapper for UserScripts.

Fetch Options

Extends the default fetch options. If using GM_xmlhttpRequest (useFetch: false), the timeout is 60 seconds.

local function parseImageString(imageString: string)
local contentId = imageString:match("(%w+://%S+)")
local width = tonumber(select(1, imageString:match("[wW](%d+)")))
local height = tonumber(select(1, imageString:match("[hH](%d+)")))
local x = tonumber(select(1, imageString:match("[xX](%d+)")))
local y = tonumber(select(1, imageString:match("[yY](%d+)")))
local color = imageString:match("(#%x+)")
local transparency = tonumber(select(1, imageString:match("(%d+)%%")))
type Set<T> = { [T]: true }
-- Asymmetric difference
local function difference<V>(set: Set<V>, ...: Set<V>): Set<V>
local diff = table.clone(set)
for index, nextSet in { ... } do
for value in nextSet do
diff[value] = nil
end
@cxmeel
cxmeel / README.md
Last active February 7, 2024 12:04
Markdown buttons

Markdown Buttons

The documentation has been moved to this gist in order to reduce lag.