Skip to content

Instantly share code, notes, and snippets.

View NQMVD's full-sized avatar

Nomad NQMVD

View GitHub Profile
"use client";
// Import necessary utilities and components.
// tailwind-merge is used to intelligently merge Tailwind CSS classes, preventing conflicts.
import React from "react";
import { twMerge } from "tailwind-merge";
// useState is a React Hook for managing state within the component.
import { useState } from "react";
// Custom icon components for the sidebar.
@NQMVD
NQMVD / serpent.lua
Created February 7, 2024 22:43
FORKED serpent by pkulchenko
local n, v = "serpent", "0.303" -- (C) 2012-18 Paul Kulchenko; MIT License
local c, d = "Paul Kulchenko", "Lua serializer and pretty printer"
local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'}
local badtype = {thread = true, userdata = true, cdata = true}
local getmetatable = debug and debug.getmetatable or getmetatable
local pairs = function(t) return next, t end -- avoid using __pairs in Lua 5.2+
local keyword, globals, G = {}, {}, (_G or _ENV)
for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false',
'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat',
'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end
@NQMVD
NQMVD / lume.lua
Created February 7, 2024 22:38
FORKED lume by rxi, maintained by me
--
-- lume
--
-- Copyright (c) 2020 rxi
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
-- this software and associated documentation files (the "Software"), to deal in
-- the Software without restriction, including without limitation the rights to
-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-- of the Software, and to permit persons to whom the Software is furnished to do
@NQMVD
NQMVD / log.lua
Created February 7, 2024 22:30
FORKED log.lua by rxi
--
-- log.lua
--
-- Copyright (c) 2016 rxi
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.
--
local log = { _version = "0.1.0" }
local lume = require "lume"
local messages = {}
messages.version = "0.1.1"
messages.list = {}
messages.defaulttimeout = 3000
messages.x, messages.y = 0, 0
messages.update = function(dt)
if lume.count(messages.list) == 0 then return end
lume.each(messages.list, function(msg)
@NQMVD
NQMVD / Lua Cheatsheet.md
Last active April 9, 2023 13:19
Lua Cheatsheet.md
@NQMVD
NQMVD / Lua Libs.md
Last active February 7, 2024 22:42
Lua Libs.md

Update:

  • don't recommend Collections anymore
    • use lume instead
  • don't recommend middleclass anymore
    • use moonscript instead
  • don't recommend inspect anymore - use serpent instead

General Lua

@NQMVD
NQMVD / Lua Cheatsheet.md
Last active March 27, 2023 10:10
Lua Cheatsheet.md
@NQMVD
NQMVD / string.format().md
Created February 24, 2023 18:05
string.format().md

values

%d: integer
%f: float
%s: string
%q: string (safe)
specifies a string format that can be safely read back into Lua code.