Skip to content

Instantly share code, notes, and snippets.

View evaera's full-sized avatar
💝

eryn L. K. evaera

💝
View GitHub Profile
@evaera
evaera / throttle.lua
Last active November 15, 2023 16:28
Roblox Lua throttle
function throttle(func, seconds)
local lastCalled = 0
local callNumber = 0
return function(...)
callNumber = callNumber + 1
local currentCallNumber = callNumber
if tick() - lastCalled < seconds then
wait(seconds - (tick() - lastCalled))
@evaera
evaera / Clean Code.md
Last active November 16, 2024 11:05
Best Practices for Clean Code
  1. Use descriptive and obvious names.
    • Don't use abbreviations, use full English words. player is better than plr.
    • Name things as directly as possible. wasCalled is better than hasBeenCalled. notify is better than doNotification.
    • Name booleans as if they are yes or no questions. isFirstRun is better than firstRun.
    • Name functions using verb forms: increment is better than plusOne. unzip is better than filesFromZip.
    • Name event handlers to express when they run. onClick is better than click.
    • Put statements and expressions in positive form.
      • isFlying instead of isNotFlying. late intead of notOnTime.
      • Lead with positive conditionals. Avoid if not something then ... else ... end.
  • If we only care about the inverse of a variable, turn it into a positive name. missingValue instead of not hasValue.
@evaera
evaera / arrow-adornment.md
Last active July 8, 2023 06:22
Roblox Arrow Adornment

Roblox Arrows for 3D Visualizations

ezgif-3-d70ddeaac0db

Installation

Quick and dirty. You probably want this for debugging, so just slap this function in wherever you want it.

Minified and full versions are included below. Pick one!

@evaera
evaera / NotionNextBirthdayFormula.md
Last active February 14, 2024 18:42
Notion Next Birthday Formula

Notion Next Birthday Formula

Given a field called Birthday (of which only the day and month are used), the Next Birthday Formula will be the date of their next birthday. It will be this year if their birthday hasn't passed yet, or next year if it is past their birthday.

Made by @lpghatguy and @evaera

The Formula

if(empty(prop("Birthday")), prop("Birthday"), dateAdd(dateAdd(dateAdd(dateAdd(fromTimestamp(0), toNumber(formatDate(prop("Birthday"), "D")) - 1, "days"), toNumber(formatDate(prop("Birthday"), "M")) - 1, "months"), toNumber(formatDate(now(), "Y")) - 1970 + if(toNumber(formatDate(now(), "M")) >= toNumber(formatDate(prop("Birthday"), "M")), if(toNumber(formatDate(now(), "D")) > toNumber(formatDate(prop("Birthday"), "D")), 1, 0), 0), "years"), 24 - toNumber(formatDate(fromTimestamp(0), "H")), "hours"))
@evaera
evaera / Cloudflare Pages deploy into subdirectories.md
Last active June 24, 2024 13:43
Cloudflare Pages deploy into subdirectories

This Github Actions workflow file lets you deploy multiple websites to Cloudflare Pages in subfolders instead of subdomains by using an intermediate repository to hold the built files.

  • Create a new repository where the files will get deployed to. That is your build repo, and you should set up your Pages from that repo.
  • Create a secret in your repo or organization called DEPLOY_PAT with the value of a GitHub personal access token of an account that has access to push to your build repo
  • Edit the values under env:
    • replace AuthorNameGoesHere with the author of the build repo
    • replace BuildRepoNameGoesHere with the name of the build repo
    • replace UsernameOfPATGoesHere with the username of the account you created the personal access token for
@evaera
evaera / proton-auto-next.md
Last active April 22, 2024 22:01
Tampermonkey script that automatically selects the next email in ProtonMail after archiving, deleting or spamming the current one.