repo stringclasses 341
values | file_path stringlengths 29 173 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.66M | tokens int64 2 598k |
|---|---|---|---|---|---|
Ince-FS/Fast-Minkowski-Shapecast | Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Ball.luau | luau | .luau | --!strict
type Ball = {
Shape: string,
Margin: number,
Transform: CFrame,
Radius: number,
fromPart: (basePart: BasePart) -> Ball,
localSupport: (n: Vector3) -> Vector3
}
return function(): Ball
local self: Ball = {
Shape = 'Ball',
Margin = 0,
Transform = CFrame.identity,
Radius = 0
} :: Ball
f... | 170 |
Ince-FS/Fast-Minkowski-Shapecast | Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Block.luau | luau | .luau | --!strict
type Block = {
Shape: string,
Margin: number,
Transform: CFrame,
Extent: Vector3,
fromPart: (basePart: BasePart) -> Block,
localSupport: (n: Vector3) -> Vector3
}
return function(): Block
local self: Block = {
Shape = 'Block',
Margin = 0,
Transform = CFrame.identity,
Extent = Vector3.zer... | 214 |
Ince-FS/Fast-Minkowski-Shapecast | Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/CornerWedge.luau | luau | .luau | --!strict
type CornerWedge = {
Shape: string,
Margin: number,
Transform: CFrame,
Extent: Vector3,
fromPart: (basePart: BasePart) -> CornerWedge,
localSupport: (n: Vector3) -> Vector3
}
local _vertices: {Vector3} = {
Vector3.new(1, 1, -1), Vector3.new(-1, -1, 1),
Vector3.new(1, -1, -1), Vector3.new(-1, -1,... | 332 |
Ince-FS/Fast-Minkowski-Shapecast | Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Cylinder.luau | luau | .luau | --!strict
type Cylinder = {
Shape: string,
Margin: number,
Transform: CFrame,
Height: number,
Radius: number,
fromPart: (basePart: BasePart) -> Cylinder,
localSupport: (n: Vector3) -> Vector3
}
return function(): Cylinder
local self: Cylinder = {
Shape = 'Cylinder',
Margin = 0,
Transform = CFrame.i... | 268 |
Ince-FS/Fast-Minkowski-Shapecast | Ince-FS-Fast-Minkowski-Shapecast-527ffab/src/Shapes/Wedge.luau | luau | .luau | --!strict
type Wedge = {
Shape: string,
Margin: number,
Transform: CFrame,
Extent: Vector3,
fromPart: (basePart: BasePart) -> Wedge,
localSupport: (n: Vector3) -> Vector3
}
local _vertices: {Vector3} = {
Vector3.new( 1, 1, 1), Vector3.new(-1, 1, 1),
Vector3.new(-1, -1, 1), Vector3.new( 1, -1, -1),
Ve... | 345 |
RiskoZS/llz4 | RiskoZS-llz4-57d8692/scripts/bench.lua | luau | .lua | local base64 = require("base64")
local llz4 = require("llz4")
local lz4 = require("lz4")
local llzw = require("llzw")
local data do
local file = assert(io.open(assert(arg[1], "missing file name"), "r"))
data = file:read("*a")
file:close()
end
local function bench(which, compress, decompress, data)
collectgarbage... | 469 |
RiskoZS/llz4 | RiskoZS-llz4-57d8692/scripts/bench.luau | luau | .luau | local base64 = require("../Base64")
local llz4 = require("../llz4-luau")
local llzw = require("../llzw-luau")
local data = require("../luau-data")[1]
local function bench(which, compress, decompress, data)
collectgarbage()
collectgarbage()
local compressStart = os.clock()
local compressed, a, b, c, d = compres... | 462 |
RiskoZS/llz4 | RiskoZS-llz4-57d8692/scripts/requireify.lua | luau | .lua | -- Turn an arbitrary file into a Lua file that returns a table with a string
-- holding the contents of said file, so that it can be loaded by Luau.
-- usage: lua requireify.lua <file>
local filename = assert(arg[1], "missing filename")
local file = assert(io.open(filename, "rb"))
local data = file:read("*a")
file:cl... | 114 |
RiskoZS/llz4 | RiskoZS-llz4-57d8692/scripts/test.lua | luau | .lua | local llz4 = require("../llz4-test")
local str = (...)
for acceleration = 1, 10 do
local compressed = llz4.compress(str, acceleration)
local decompressed = llz4.decompress(compressed)
assert(decompressed == str, "decompressed doesn't match original")
end
| 66 |
ddeityies/quantum | ddeityies-quantum-535687b/algo.luau | luau | .luau | --!native
--!optimize 2
--!strict
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type matrix = {{complex}}
type matrix_sz = {r: number, c: number}
local algo = {}
function algo.shor(n: number):... | 1,286 |
ddeityies/quantum | ddeityies-quantum-535687b/anneal.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
type hamiltonian = {{number}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
local qb = require("qb")
local preset ... | 2,359 |
ddeityies/quantum | ddeityies-quantum-535687b/anyon.luau | luau | .luau | --!native
--!optimize 2
--!strict
local cpx = require("cpx")
local mtx = require("mtx")
local qb = require("qb")
type complex = {r: number, i: number}
type matrix = {{complex}}
type qubit = {complex}
type qubits = {qubit}
local anyon = {}
local function braidgenerator(n: number, i: number): matrix
local dim = 2^n
... | 1,250 |
ddeityies/quantum | ddeityies-quantum-535687b/circuitvis.luau | luau | .luau | --!native
--!optimize 2
--!strict
local circuitvis = {}
export type gate = string
export type qubit = {gate}
export type circuit = {qubit}
export type grid = {{string}}
local function creategrid(rows: number, cols: number): grid
local grid = table.create(rows)
for i = 1, rows do
grid[i] = table.create(cols, " ")... | 765 |
ddeityies/quantum | ddeityies-quantum-535687b/compiler.luau | luau | .luau | --!native
--!optimize 2
--!strict
-- feel free to advance this further i'm too lazy
-- dude?? it's literally like basic stuff
local EPSILON = 1e-10
local MAX_QUBITS = 10
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type operation = {gate: string, target: ... | 1,672 |
ddeityies/quantum | ddeityies-quantum-535687b/cpx.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
local cpx = {}
function cpx.new(real: number?, imaginary: number?): complex
return {r = real or 0, i = imaginary or 0}
end
function cpx.add(c1: complex, c2: complex)
return cpx.new(c1.r + c2.r, c1.i + c2.i)
end
function cpx.sub(c1: comple... | 1,370 |
ddeityies/quantum | ddeityies-quantum-535687b/crypmethods.luau | luau | .luau | --!native
--!optimize 2
--!strict
local bit32 = require("bit32")
local cpx = require("cpx")
local mtx = require("mtx")
local crypmethods = {}
type Vector = {number}
type Matrix = {Vector}
type EllipticCurve = {a: number, b: number}
type EllipticCurvePoint = {x: number, y: number}
local function keccak(message: stri... | 9,008 |
ddeityies/quantum | ddeityies-quantum-535687b/crypto.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type bits = {number}
local qb = require("qb")
local gate = require("gate")
local cpx = require("cpx")
local preset = require("preset")
local crypto = {}
local bb84 = {}
local function random_bit(): ... | 6,582 |
ddeityies/quantum | ddeityies-quantum-535687b/decay.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local preset = require("preset")
local decay = {}
function decay.new(probabilities: {
amplitude_damping: number?;
phas... | 564 |
ddeityies/quantum | ddeityies-quantum-535687b/ent.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
local cpx = require("cpx")
local ent = {}
local bell = {}
loc... | 1,745 |
ddeityies/quantum | ddeityies-quantum-535687b/err.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
local qb = require("qb")
local preset = require("preset")
local err... | 4,823 |
ddeityies/quantum | ddeityies-quantum-535687b/gate.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type matrix = {{complex}}
export type gate = {{complex}}
local cpx = require("cpx")
local mtx = require("mtx")
local gate = {}
function gate.new(a11: complex, a12: complex, a21: complex, a22: complex... | 4,185 |
ddeityies/quantum | ddeityies-quantum-535687b/kitaev.luau | luau | .luau | --!native
--!optimize 2
--!strict
type kitaev_obj = {
__index : kitaev_obj;
init_chain: (chain_size: number?, delta: number?, mu: number?, t: number?, time_step: number?) -> kitaev_meta;
apply_majorana: (self: kitaev_meta, i: number, mode: number) -> ();
hamiltonian: (self: kitaev_meta) -> number;
detect_majorana... | 1,642 |
ddeityies/quantum | ddeityies-quantum-535687b/mtx.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type matrix = {{complex}}
type matrix_sz = {r: number, c: number}
local cpx = require("cpx")
local mtx = {}
function mtx.new(size: matrix_sz, ...: complex)
local elements = {...}
if #elements ~= size.r * size.c then
error("number of element... | 1,693 |
ddeityies/quantum | ddeityies-quantum-535687b/noise.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
export type noise_obj = {
__index: noise_obj;
new: ( probabilities: {
bitflip: number?;
phaseflip: number?;
depolarizing: number?;
}) -> noise_... | 727 |
ddeityies/quantum | ddeityies-quantum-535687b/preset.luau | luau | .luau | --!native
--!optimize 2
--!strict
local cpx = require("cpx")
local gate = require("gate")
return {
identity = gate.new(
cpx.new(1, 0), cpx.new(0, 0),
cpx.new(0, 0), cpx.new(1, 0)
);
paulix = gate.new(
cpx.new(0, 0), cpx.new(1, 0),
cpx.new(1, 0), cpx.new(0, 0)
);
pauliy = gate.new(
cpx.new(0, 0), cpx.ne... | 1,440 |
ddeityies/quantum | ddeityies-quantum-535687b/qb.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
-- NOTE: THIS IS FOR SINGULAR QUBIT SYSTEMS
-- MULTI-QUBIT FUNCTION... | 3,225 |
ddeityies/quantum | ddeityies-quantum-535687b/qmacs.luau | luau | .luau | --!native
--!optimize 2
--!strict
local quantum = require("quantum")
local cpx = quantum.cpx
local gate = quantum.gate
local qb = quantum.qb
local mtx = quantum.mtx
local preset = quantum.preset
export type complex = quantum.complex
export type qubit = quantum.qubit
export type qubits = quantum.qubits
export type gat... | 1,959 |
ddeityies/quantum | ddeityies-quantum-535687b/qml.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type kernel_t = ("polynomial" | "gaussian" | "quantum")?
local qb = require("qb")
local cpx = require("cpx")
local gate = require("gate")
local qml = {}
local qsvm = {}
local function get_kernel(ker... | 2,840 |
ddeityies/quantum | ddeityies-quantum-535687b/qsmc.luau | luau | .luau | --!native
--!optimize 2
--!strict
local qb = require("qb")
local cpx = require("cpx")
local gate = require("gate")
local preset = require("preset")
type Bit = number -- 0 or 1
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type Party = {
id: number,
input: Bit,
qubit: ... | 1,061 |
ddeityies/quantum | ddeityies-quantum-535687b/quantum.luau | luau | .luau | --!native
--!optimize 2
--!strict
math.randomseed(os.time())
export type complex = {r: number, i: number}
export type qubit = {complex}
export type qubits = {qubit}
export type gate = {{complex}}
export type matrix = {{complex}}
export type matrix_sz = {r: number, c: number}
return {
mtx = require("mtx");
cpx = requ... | 222 |
ddeityies/quantum | ddeityies-quantum-535687b/quantum.v0.luau | luau | .luau | math.randomseed(os.time())
----------------------------------------------------------------------------------------------
type complex = {r : number, i : number}
type qubit = {complex}
type gate = {{complex}}
----------------------------------------------------------------------------------------------
local cpx = ... | 2,258 |
ddeityies/quantum | ddeityies-quantum-535687b/secret_sharing.luau | luau | .luau | --!native
--!optimize 2
--!strict
local quantum = require("quantum")
local cpx = quantum.cpx
local qb = quantum.qb
local gate = quantum.gate
local preset = quantum.preset
local secret_sharing = {}
export type complex = {r: number, i: number}
export type qubit = {complex}
export type qubits = {qubit}
-- Classical S... | 1,345 |
ddeityies/quantum | ddeityies-quantum-535687b/tp.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
local tp = {}
function tp.entangle(): qubits
local qubits = q... | 349 |
ddeityies/quantum | ddeityies-quantum-535687b/wave.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local wave = {}
-- apply hadamard to qubits to create wave-like superposition
function wave.ap... | 316 |
Roblox/zen-observable-lua | Roblox-zen-observable-lua-7c7dab8/bin/spec.lua | luau | .lua | local ProcessService = game:GetService("ProcessService")
local Root = script.Parent.ZenObservableTestModel
local Packages = Root.Packages
-- Load JestGlobals source into Packages folder so it's next to Roact as expected
local JestGlobals = require(Root.Packages.Dev.JestGlobals)
local TestEZ = JestGlobals.TestEZ
-- Ru... | 150 |
Roblox/zen-observable-lua | Roblox-zen-observable-lua-7c7dab8/src/init.lua | luau | .lua | --!strict
local exports = {}
local ObservableModule = require(script.Observable)
local Observable = ObservableModule.Observable
exports.Observable = Observable
export type SubscriptionObserver<T> = ObservableModule.SubscriptionObserver<T>
export type Observer<T> = ObservableModule.Observer<T>
export type Subscriber<T>... | 91 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lune/dev.luau | luau | .luau | local process = require("@lune/process")
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd .. ".luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = ... | 176 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lune/start.luau | luau | .luau | local process = require("@lune/process")
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd .. ".luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = ... | 173 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lune/test.luau | luau | .luau | local process = require("@lune/process")
local child = process.exec("lune", { "run", "tests" }, { stdio = "inherit" })
if not child.ok then
process.exit(child.code)
end
| 48 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lute/dev.luau | luau | .luau | local process = require("@lute/process")
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias... | 179 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lute/start.luau | luau | .luau | local process = require("@lute/process")
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias... | 176 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.lute/test.luau | luau | .luau | local process = require("@lute/process")
local child = process.run({ "lute", "run", "tests" }, { stdio = "inherit" })
if not child.ok then
process.exit(child.exitcode)
end
| 49 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.zune/dev.luau | luau | .luau | local process = zune.process
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = process.c... | 181 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.zune/start.luau | luau | .luau | local process = zune.process
local serde = require("@adpt/serde")
local fs = require("@adpt/fs")
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = serde.decode("json", luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = process.c... | 178 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/.zune/test.luau | luau | .luau | local process = zune.process
local child = process.run("zune", { "run", "tests" }, { stdout = "inherit", stderr = "inherit" })
if not child.ok then
process.exit(child.code)
end
| 50 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/checkRuntime.luau | luau | .luau | local runtime = string.split(_VERSION, " ")[1]:lower()
local function checkRuntime()
return runtime
end
return checkRuntime
| 28 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/fs/init.luau | luau | .luau | local Types = require("./fs/types")
local checkRuntime = require("./checkRuntime")
local function getAdapter(): Types.FsAdapter
local runtime = checkRuntime()
if runtime == "lune" then
return require("@self/lune")
elseif runtime == "zune" then
return require("@self/zune")
elseif runtime == "luau" then
retur... | 104 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/fs/lune.luau | luau | .luau | local fs = require("@lune/fs")
local Types = require("./types")
local LuneFs = {} :: Types.FsAdapter
local isFile = fs.isFile
local readFile = fs.readFile
local writeFile = fs.writeFile
local isDir = fs.isDir
local readDir = fs.readDir
local metadata = fs.metadata
function LuneFs.isFile(path: string)
return isFile(... | 178 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/fs/lute.luau | luau | .luau | local fs = require("@lute/fs")
local Types = require("./types")
local LuteFs = {} :: Types.FsAdapter
local stat = fs.stat
local open = fs.open
local read = fs.read
local close = fs.close
local write = fs.write
local listdir = fs.listdir
function LuteFs.isFile(path: string)
local ok, err = pcall(function()
return ... | 466 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/fs/types.luau | luau | .luau | export type FsMetadata = {
kind: "file" | "dir",
exists: boolean,
createdAt: number,
modifiedAt: number,
accessedAt: number,
permissions: {
readOnly: boolean,
},
}
export type FsAdapter = {
isFile: (path: string) -> boolean,
readFile: (path: string) -> string,
writeFile: (path: string, contents: buffer | s... | 134 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/fs/zune.luau | luau | .luau | local fs = zune.fs
local Types = require("./types")
local ZuneFs = {} :: Types.FsAdapter
local stat = fs.stat
local readFile = fs.readFile
local writeFile = fs.writeFile
function ZuneFs.isFile(path: string)
local fileStat = stat(path)
return fileStat.kind == "file"
end
function ZuneFs.readFile(path: string)
retu... | 272 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/net/lune.luau | luau | .luau | local net = require("@lune/net")
local Types = require("./types")
local LuneNet = {} :: Types.NetAdapter
local serve = net.serve
local request = net.request
function LuneNet.serve(port, handlerOrConfig)
serve(port, handlerOrConfig :: any)
end
function LuneNet.request(config)
return request(config :: any) :: any
e... | 87 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/net/lute.luau | luau | .luau | local server = require("@lute/net/server")
local client = require("@lute/net/client")
local Types = require("./types")
local LuteNet = {} :: Types.NetAdapter
local req = client.request
local serve = server.serve
function LuteNet.serve(port, handlerOrConfig)
if not (typeof(handlerOrConfig) == "table") then
return
... | 267 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/normalizeHeader.luau | luau | .luau | -- Normalizes an HTTP header key to a consistent Pascal-Case format (e.g., "content-type" -> "Content-Type").
local cache: { [string]: string } = {}
local function normalizeHeader(header: string): string
local cached = cache[header]
if cached then
return cached
end
local normalized = header:lower():gsub("%f[%a]... | 99 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/process/init.luau | luau | .luau | local Types = require("./process/types")
local checkRuntime = require("./checkRuntime")
local function getAdapter(): Types.ProcessAdapter
local runtime = checkRuntime()
if runtime == "lune" then
return require("@self/lune")
elseif runtime == "zune" then
return require("@self/zune")
elseif runtime == "luau" th... | 103 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/process/lune.luau | luau | .luau | -- nova/src/libs/process/lune.luau
local process = require("@lune/process")
local Types = require("./types")
local LuneProcess = {} :: Types.ProcessAdapter
local cwd = process.cwd
local env = process.env
local args = process.args
local create = process.create
local exit = process.exit
LuneProcess.cwd = cwd
LuneProce... | 129 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/process/lute.luau | luau | .luau | local process = require("@lute/process")
local Types = require("./types")
local LuteProcess = {} :: Types.ProcessAdapter
local cwd = process.cwd
local env = process.env
local args = process.args
local run = process.run
local exit = process.exit
LuteProcess.cwd = cwd() .. "/"
LuteProcess.env = env :: { [string]: stri... | 155 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/process/types.luau | luau | .luau | -- nova/src/libs/process/types.luau
export type ProcessOptions = {
cwd: string?,
env: { [string]: string }?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}
export type ProcessChild = {
pid: number,
stdin... | 204 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/process/zune.luau | luau | .luau | -- nova/src/libs/process/zune.luau
local process = zune.process
local Types = require("./types")
local ZuneProcess = {} :: Types.ProcessAdapter
local cwd = process.cwd
local env = process.env
local args = process.args
local create = process.create
local exit = process.exit
ZuneProcess.cwd = cwd() .. "/"
ZuneProcess.... | 133 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/serde/init.luau | luau | .luau | local Types = require("./serde/types")
local checkRuntime = require("./checkRuntime")
local function getAdapter(): Types.SerdeAdapter
local runtime = checkRuntime()
if runtime == "lune" then
return require("@self/lune")
elseif runtime == "zune" then
return require("@self/zune")
elseif runtime == "luau" then
... | 104 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/serde/lune.luau | luau | .luau | local serde = require("@lune/serde")
local Types = require("./types")
local LuneSerde = {} :: Types.SerdeAdapter
local decode = serde.decode
local encode = serde.encode
function LuneSerde.decode(format, encoded)
return decode(format, encoded)
end
function LuneSerde.encode(format, value, pretty)
return encode(form... | 88 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/serde/lute.luau | luau | .luau | local json = require("@std/json")
local Types = require("./types")
local LuneSerde = {} :: Types.SerdeAdapter
local deserialize = json.deserialize
local serialize = json.serialize
function LuneSerde.decode(format, encoded)
if not (format == "json") then
error("Unsupported format: " .. format)
end
return deseri... | 126 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/serde/types.luau | luau | .luau | export type Format = "json" | "jsonc" | "toml" | "yaml"
export type Encoded = string
export type SerdeAdapter = {
encode: (format: Format, value: any, pretty: boolean?) -> string,
decode: (format: Format, encoded: Encoded) -> any,
}
return {}
| 73 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/serde/zune.luau | luau | .luau | local serde = zune.serde
local Types = require("./types")
local LuneSerde = {} :: Types.SerdeAdapter
local encoders = {
json = serde.json.encode,
toml = serde.toml.encode,
yaml = serde.yaml.encode,
}
local decoders = {
json = serde.json.decode,
toml = serde.toml.decode,
yaml = serde.yaml.decode,
}
function Lu... | 181 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/task/init.luau | luau | .luau | local Types = require("./task/types")
local checkRuntime = require("./checkRuntime")
local function getAdapter(): Types.TaskAdapter
local runtime = checkRuntime()
if runtime == "lune" then
return require("@self/lune")
elseif runtime == "zune" then
return require("@self/zune")
elseif runtime == "luau" then
r... | 103 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/task/lune.luau | luau | .luau | local task = require("@lune/task")
local Types = require("./types")
local LuneTask = {} :: Types.TaskAdapter
local wait = task.wait
function LuneTask.wait(duration)
return wait(duration)
end
return LuneTask
| 51 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/task/lute.luau | luau | .luau | local task = require("@lute/task")
local Types = require("./types")
local LuneTask = {} :: Types.TaskAdapter
local wait = task.wait
function LuneTask.wait(duration)
return wait(duration)
end
return LuneTask
| 51 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/task/types.luau | luau | .luau | export type TaskAdapter = {
wait: (duration: number) -> number,
}
return {}
| 19 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/adapter/task/zune.luau | luau | .luau | local task = zune.task
local Types = require("./types")
local ZuneTask = {} :: Types.TaskAdapter
local wait = task.wait
function ZuneTask.wait(duration)
return wait(duration)
end
return ZuneTask
| 49 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Attribute/Interceptor.luau | luau | .luau | local registry = require("./RegistryGenerator").registry
local Types = require("../../types")
local function Interceptor(args: { string })
return function(req: Types.Request, next: Types.Next)
local attribute = registry["Interceptor"]
if not attribute then
return next()
end
... | 181 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Attribute/Resolver.luau | luau | .luau | local MAX_ATTRIBUTES = 10
--// PARSER // --
local function parseArgs(raw: string): { string }
local args = {}
for arg in raw:gmatch("([^,]+)") do
local trimmed = arg:match("^%s*(.-)%s*$")
if trimmed and trimmed ~= "" then
table.insert(args, trimmed)
end
end
return args
end
--[[
Parse a string att... | 856 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/BodyParser.luau | luau | .luau | local serde = require("../adapter/serde")
type BodyParsers = { [string]: (raw: string) -> string | { any } }
local decode = serde.decode
local BodyParser: BodyParsers = {}
BodyParser["text/plain"] = function(raw: string)
return raw
end
BodyParser["application/json"] = function(raw: string)
local ok, result = pca... | 321 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Routing/CreateTestRouter.luau | luau | .luau | local RouteHelper = require("./Helpers")
local RouteMatcher = require("./Matcher")
local splitPath = RouteHelper.splitPath
local createNode = RouteHelper.createNode
local matchRouteFrom = RouteMatcher.matchRouteFrom
local function createTestRouter()
local staticRoute: { [string]: any } = {}
local root: RouteHelper.... | 493 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Routing/Generator.luau | luau | .luau | local fs = require("../../adapter/fs")
local process = require("../../adapter/process")
local registerRoute = require("./RegisterRoute")
local AttributeResolver = require("../Attribute/Resolver")
local Attributes = require("../Attribute")
local Chain = require("../../utils/Chain")
local RouteHelper = require("./Helpers... | 738 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Routing/Helpers.luau | luau | .luau | export type RouteNode = {
children: { [string]: RouteNode },
dynamicChild: RouteNode?,
dynamicName: string?,
wildcardChild: RouteNode?,
wildcardName: string?,
module: any?,
}
type METHOD_MAP = {
[string]: string,
}
local staticRoutes: { [string]: any } = {}
local routeTreeRoot: RouteNode = {
children = {}... | 246 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Routing/Matcher.luau | luau | .luau | local RouteHelper = require("./Helpers")
local function matchRouteFrom(
node: RouteHelper.RouteNode,
segments: { string },
index: number,
params: { [string]: any }
): RouteHelper.RouteNode?
while index <= #segments do
local segment = segments[index]
if node.children[segment] then
node = node.children[segm... | 495 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/core/Routing/RegisterRoute.luau | luau | .luau | local RouteHelper = require("./Helpers")
local staticRoutes = RouteHelper.staticRoutes
local routeTreeRoot = RouteHelper.routeTreeRoot
local splitPath = RouteHelper.splitPath
local createNode = RouteHelper.createNode
local function registerRoute(path: string, module: any)
if not string.find(path, "%[") then
stati... | 326 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/utils/Exception.luau | luau | .luau | local Exception = {}
-- // BASE EXCEPTION FUNCTION // --
function Exception.HttpException(statusCode: number, message: string)
return {
statusCode = statusCode,
message = message
}
end
-- // COMMON 4xx // --
function Exception.BadRequest(message: string?)
return Exception.HttpException(4... | 277 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/utils/GenerateAlias.luau | luau | .luau | local serde = require("../adapter/serde")
local fs = require("../adapter/fs")
local process = require("../adapter/process")
local function generateAlias()
local luauarcPath = process.cwd .. "/.luaurc"
if not luauarcPath then
error("Luaurc file is not found in your project.")
end
local luaurcJson = fs.readFile(... | 149 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/utils/LoadEnv.luau | luau | .luau | local process = require("../adapter/process")
local fs = require("../adapter/fs")
local function loadEnv()
local envVars: { [string]: string } = {}
local content: string?
for _, filename in { ".env", ".env.local", ".env.development" } do
local success, result = pcall(fs.readFile, filename)
if success then
c... | 217 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/utils/Logger.luau | luau | .luau | --[[
This will be the template for what the logger supposed to output:
(Startup Message)
Middleware: Logger · cors · rateLimiter
Routes:
GET / Guard(AuthRule, AdminRule) · Interceptor(TransformRule)
POST / Guard(AuthRule)
GET /users ... | 807 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/src/utils/MainDir.luau | luau | .luau | return "src/app"
| 5 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/adapters/fs/fs.test.luau | luau | .luau | local runner = require("@test-runner")
local fs = require("@adpt/fs")
local FIXTURES = "./tests/fixtures/fs"
local describe, test, expect = runner.describe, runner.test, runner.expect
local function Test()
describe("isFile", function()
test("returns true for an existing file", function()
local result = fs.isFi... | 493 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/init.luau | luau | .luau | local fs = require("@adpt/fs")
local runner = require("@self/runner")
local function findTestFiles(dir: string): { string }
local results = {}
for _, entry in fs.readDir(dir) do
local fullPath = dir .. "/" .. entry
if fs.isDir(fullPath) then
for _, nested in findTestFiles(fullPath) do
table.insert(resul... | 200 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/runner.luau | luau | .luau | local process = require("@adpt/process")
export type Expected = {
toBe: (expected: any) -> (),
toEqual: (expected: any) -> (),
toBeNil: (expected: any) -> (),
never: (expected: any) -> (),
}
export type TestRunner = {
describe: (name: string, fn: () -> ()) -> (),
test: (name: string, fn: () -> ()) -> (),
summa... | 749 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/unit/router.test.luau | luau | .luau | local runner = require("@test-runner")
local describe, test, expect = runner.describe, runner.test, runner.expect
local createRouter = require("@core/Routing/CreateTestRouter")
local function Test()
describe("static routes", function()
test("matches an exact path", function()
local router = createRouter()
lo... | 771 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/app/users/users.service.luau | luau | .luau | local UserService = {}
function UserService.getUser(userId: number)
return {
msg = "Hello, user " .. userId,
}
end
return UserService
| 31 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/guards/Admin.luau | luau | .luau | local Types = require("@nova-types")
local function Auth(_req: Types.Request)
print("Admin Check")
return true
end
return Auth
| 31 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/guards/Auth.luau | luau | .luau | local Types = require("@nova-types")
local function Auth(_req: Types.Request)
print("Auth Check")
return true
end
return Auth
| 31 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/interceptors/Transform.luau | luau | .luau | local Types = require("@nova-types")
local function Transform(_req: Types.Request, next: Types.Next)
next()
end
return Transform
| 30 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/main.luau | luau | .luau | local Nova = require("@nova")
local process = require("@adpt/process")
local PORT = tonumber(process.env.PORT) or 8080
local app = Nova.new(PORT, {
Test1 = function(_req, next)
next()
end,
Test2 = function(_req, next)
next()
end
})
app:listen(function()
print(`Nova is running on Port ... | 87 |
mayari-org/mayari | mayari-org-mayari-f9a8f06/tests/web/src/validators/createUser.luau | luau | .luau | local Types = require("@nova-types")
local schema: Types.ValidatorSchema = {
body = {
username = { type = "string", required = true, min = 3, max = 20 },
age = { type = "number", required = true, min = 18 },
email = { type = "string", required = true, pattern = "^[^@%s]+@[^@%s]+%.[^@%s]+$" ... | 104 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/examples/basic_mouse_ball.luau | luau | .luau | --!strict
--!optimize 2
--!native
local raylib = require("@raylib")
local lib = raylib.lib;
local const = raylib.const;
local structs = raylib.structs;
local screenWidth = 800;
local screenHeight = 450;
lib.InitWindow(screenWidth, screenHeight, "ZUNE + Raylib");
lib.SetTargetFPS(240);
local pos: raylib.Vector2 = ... | 303 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/init.luau | luau | .luau | --!strict
local native = require("@self/native");
local raylib = require("@self/native/raylib");
export type Vector2 = raylib.Vector2
export type Vector3 = raylib.Vector3
export type Vector4 = raylib.Vector4
export type Quaternion = raylib.Quaternion
export type Matrix = raylib.Matrix
export type Color = raylib.Color... | 468 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/lib/tar.luau | luau | .luau | --!strict
--!optimize 2
--!native
local tar = {};
local function spanstring(buf: buffer, offset: number, max: number): string
return buffer.readstring(
buf,
offset,
math.min(
(zune.mem.findScalarPos(buf, offset, 0) or offset + max) - offset,
max
)
);
end... | 453 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/lib/zip.luau | luau | .luau | --!strict
--!optimize 2
--!native
local mem = zune.mem;
local flate = zune.serde.flate;
local zip = {};
local EOCD_SIGNATURE = buffer.fromstring("\x50\x4b\x05\x06");
function zip.is(buf: buffer): boolean
local len = buffer.len(buf);
if len < 22 then
return false;
end
return mem.findPos(buf, ... | 577 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/native/audio.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local uint = ffi.types.u32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local cstring = ffi.types.pointer;
type int = numb... | 2,870 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/native/models.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local cstring = ffi.types.pointer;
type int = number;
type uint = number;
type... | 5,037 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/native/raylib.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local int = ffi.types.i32;
local uint = ffi.types.u32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local Vector2 = ffi.types.vector2_32;
export type Vector2 = vector;
local Vector3 = ffi.types.vector3_32;
export type Vector3 = vector;
local Vect... | 9,297 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-1aa4fbb/src/native/shapes.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local bool = ffi.types.u8;
local float = ffi.types.float;
type int = number;
type bool = number;
type float = number;
type cstring = str... | 4,915 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.