Skip to content

Instantly share code, notes, and snippets.

View hryx's full-sized avatar
🌵
°_o

Stevie Hryciw hryx

🌵
°_o
View GitHub Profile
@hryx
hryx / ecs-recycling.html
Created September 29, 2024 17:31
ECS Recycling Program prototype
<html>
<head>
<meta charset="utf-8" />
<title>ECS entity ID recycling program</title>
<style type="text/css">
#wrapper {
margin: 20px 50px 20px 50px;
}
button, input, div, p, label {
@hryx
hryx / indentstats.lua
Created May 8, 2019 02:58
Report indentation health of source file
-- Usage: cat file.cpp | lua indentstats.lua
-- Currently assumes 4-space indentation.
-- Fun exercise: add flags for tab/space and number of spaces
local sloc = 0
local total = 0.0
local indents = {}
while true do
// Original: https://gist.github.com/jrfondren/b049085f8c74482b96097f7db16a18eb
// zig build-exe dns2.zig --library c
// zig version 0.3.0+ef5d7ce4
const std = @import("std");
const c = @cImport({
@cInclude("netdb.h");
});
pub fn main() !void {
@hryx
hryx / keybase.md
Created August 8, 2015 03:59
obligatory

Keybase proof

I hereby claim:

  • I am hryx on github.
  • I am hryx (https://keybase.io/hryx) on keybase.
  • I have a public key whose fingerprint is 6404 51F3 3FAA D37F 8959 D482 AA0B 6FE5 6413 BA0F

To claim this, I am signing this object:

@hryx
hryx / fullwidth.lua
Created October 17, 2014 08:06
Annoy People with Ease: Fullwidth Converter
--[[
Turn ASCII text into equivalent fullwidth form characters.
Characters with no fullwidth equivalent are left in-tact.
Input is assumed to be valid UTF-8; output is also UTF-8.
Requires utf8.lua by VRLD:
https://github.com/vrld/Quickie/blob/master/utf8.lua
Publick Domaine
@hryx
hryx / history.lua
Created November 10, 2013 13:36
History undo/redo -- simple system using closures
-- History: undo/redo stack
-- by hryx 2013
-- Super basic example:
--[[
history = require('history')
h = history.new(40) -- limit to 40 latest events
local cmd = {skulls = 19}
cmd.redo = function() cmd.skulls = cmd.skulls + 204
cmd.undo = function() cmd.skulls = cmd.suklls - 204
@hryx
hryx / array2d.lua
Created November 10, 2013 13:21
2-dimensional array class (needs work)
-- Generic and incomplete 2-dimensional array class
-- by hryx 2013
-- This can probably be improved in ten hundred ways.
-- Yell your suggestions at my sour face!
-- An array2d instance is a table of rows (y).
-- A row is a table of columns (x).
-- Columns are initially all nil. Fill them with whatever you like.
@hryx
hryx / main.lua
Created February 6, 2012 07:23
Particle demo for LÖVE
-- Particle system demo for LÖVE (0.8.0+)
-- by hryx 2012
-- publimc domainp
-- TODO
---- Switch from trigonometry to vectors for performance.
---- Compensate particle emission speed when moving forward/backward.
function love.load()
-- It's-a me
@hryx
hryx / main.lua
Created February 5, 2012 09:20
Drag & drop rectangular objects in LOVE
-- TugMe r2
-- Basic clickin' 'n' draggin' 'n' droppin'
-- by hryx 2012
-- publicke domaine
function love.load()
icon = {}
icon.img_default = love.graphics.newImage('default.png')
icon.img_hover = love.graphics.newImage('hover.png')
icon.img_click = love.graphics.newImage('click.png')
@hryx
hryx / gist:1743761
Created February 5, 2012 07:15
Check for any alphabetical key pressed
function love.keypressed(k)
if string.match(k, '^[a-z]$') then
print('yes') -- or do something else
end
end