Skip to content

Instantly share code, notes, and snippets.

@GlorifiedPig
GlorifiedPig / hook.lua
Last active April 21, 2023 12:12
Lua Hook Library
--- A library used for calling and attaching hooks.
-- @module Hook
Hook = {}
local cachedHooks = {}
--- Attaches a function to a hook.
-- @string hookID The string ID of the hook to be attached to.
-- @string uniqueID The unique ID of the function you are attaching to the hook.
-- @func func The function to be called when the hook is called.
@GlorifiedPig
GlorifiedPig / CLRConversions.cs
Created July 13, 2020 13:39
MoonSharp Colors
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Table, typeof(Color),
dynVal => {
Table table = dynVal.Table;
float r = (float)table.Get("r").CastToNumber();
float g = (float)table.Get("g").CastToNumber();
float b = (float)table.Get("b").CastToNumber();
float a = (float)table.Get("a").CastToNumber();
return new Color(r, g, b, a);
}
);
@GlorifiedPig
GlorifiedPig / CLRConversions.cs
Last active September 8, 2024 18:32
MoonSharp Vectors
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Table, typeof(Vector3),
dynVal => {
Table table = dynVal.Table;
float x = (float)table.Get("x").CastToNumber();
float y = (float)table.Get("y").CastToNumber();
float z = (float)table.Get("z").CastToNumber();
return new Vector3(x, y, z);
}
);
Script.GlobalOptions.CustomConverters.SetClrToScriptCustomConversion<Vector3>(
@victornpb
victornpb / deleteDiscordMessages.js
Last active October 10, 2024 23:24
Delete all your messages from DM or Channel in Discord
/*
This file is now hosted here:
https://github.com/victornpb/undiscord
*/
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active October 19, 2024 07:05
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@basham
basham / css-units-best-practices.md
Last active October 9, 2024 20:03
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">