Skip to content

Instantly share code, notes, and snippets.

View drhayes's full-sized avatar
🐱

David Hayes drhayes

🐱
View GitHub Profile
@drhayes
drhayes / work-nerds-code-of-conduct.md
Last active May 26, 2021 22:03
The Code of Conduct for the Discord server Work Nerds

Welcome to the Work Nerds community!

In order to foster a welcoming and inclusive environment for everyone, we ask all members to read and agree to our Code of Conduct when joining. This Code of Conduct is a living document and will be updated from time to time as necessary. The current version can always be found at https://drhay.es/work-nerds-coc. All changes will be announced in the #announcements channel of our Discord server as they are made. Agreeing to the Code of Conduct implies that you will monitor these changes and revoke your agreement if and when you no longer agree.

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible

const { exec } = require('child_process');
const verbData = {
chore: {
label: 'Chores',
renderOrder: 4,
},
feat: {
label: 'New Features',
renderOrder: 0,
@drhayes
drhayes / button.lua
Created April 3, 2020 01:30
The basic button control from my GUI lib in Gemini Rising
local Button = Control:extend()
Button:implement(EventEmitter)
function Button:new(text, x, y, w, h)
self.text = text
w = w or (ui.font:getWidth(text) + 20)
h = h or 20
Button.super.new(self, x, y, w or 40, h)
self.layout = fillLayout(0)
self.fill = self:add(Fill())
@drhayes
drhayes / release.sh
Created February 18, 2020 19:47
Gemini Rising release script as of 2020-02-18
#!/usr/bin/env bash
set -e
set -x
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MY_DIR=$(realpath "${MY_DIR}"/..)
GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$MY_DIR}
LOVEVERSION="11.2"
# From http://lua.space/general/assert-usage-caveat
function xassert(a, ...)
if a then return a, ... end
local f = ...
if type(f) == "function" then
local args = {...}
table.remove(args, 1)
error(f(unpack(args)), 2)
else
error(f or "assertion failed!", 2)
@drhayes
drhayes / eventEmitter.lua
Last active September 9, 2019 20:31
`EventEmitter` in Lua (primarily) for my OOP-y, retained-mode, gamepad-friendly UI library.
local Object = require 'lib.classic'
local function push (t, ...)
local pushed = select('#', ...)
for i = 1, pushed do
t[t.n + i] = select(i, ...)
end
return t.n + pushed
@drhayes
drhayes / README.md
Created April 1, 2019 15:54
SCRIPT-8
@drhayes
drhayes / brain.lua
Created March 22, 2019 17:13
An old, busted version of coroutine-based AI
local Brain = {}
local currentTime = 0
local timeWaits = {}
local animWaits = {}
local yields = {}
local function yield()
local co = coroutine.running()
yields[co] = true
return coroutine.yield(co)
@drhayes
drhayes / brain.lua
Created March 22, 2019 17:11
An old coroutine-based AI
local lume = require 'lib/lume'
local Brain = {}
local currentTime = 0
local timeWaits = {}
local animWaits = {}
local function waitSeconds(secs)
local co = coroutine.running()
timeWaits[co] = currentTime + secs
@drhayes
drhayes / syncFacingSchemes.lua
Last active August 27, 2018 14:33
Slerp between rotations without doing the flippy thing.
local ax, ay = math.cos(fov.angle), math.sin(fov.angle)
local gx, gy = math.cos(goalAngle), math.sin(goalAngle)
ax, ay = ax + gx * 5 * dt, ay + gy * 5 * dt
fov.angle = math.atan2(ay, ax)