Skip to content

Instantly share code, notes, and snippets.

View pablomayobre's full-sized avatar
📖
Learning new technologies

Pablo Ariel Mayobre pablomayobre

📖
Learning new technologies
  • NewCombin
  • Trelew, Chubut, Argentina
View GitHub Profile
class PathMe {
moves: string[] = [];
constructor() {
this.moves = [];
return this;
}
moveTo(x: number, y: number) {
@gavrilov
gavrilov / readme.md
Last active October 11, 2025 20:41
Obsidian voice recognition with local Whisper model

Obsidian voice recognition with local Whisper model

Install plugin Whisper for Obsidian

plugin's settings:

@tesselode
tesselode / swept-aabb.lua
Last active February 8, 2025 17:06
swept AABB collision detection implemented in Lua (commentated)
--[[
moves rectangle A by (dx, dy) and checks for a collision
with rectangle B.
if no collision occurs, returns false.
if a collision does occur, returns:
- the time within the movement when the collision occurs (from 0-1)
- the x component of the normal vector
- the y component of the normal vector
@1bardesign
1bardesign / ecs_writeup.md
Last active June 2, 2020 13:42
Hopefully straightforward writeup on the design of my lua-side "ecs", which I should find a better name for.

Components:

  • Managed by systems, self-contained as much as possible
  • May have references to components in other systems that they're dependent on (eg a sprite might want a position, though it may accept any vector (shared or unshared) for that position)
  • Generally take those references in their constructor
  • Generally designed to have a nice oop-y method interface, rather than be "just" data - eg sprite:set_frame(fx, fy), animation:reset() etc

Systems:

  • Do stuff with their set of components
@josefnpat
josefnpat / callgrind.lua
Last active February 27, 2019 23:37
Callgrind module for Lua 5.1 / LuaJIT
--[[
Copyright 2007 Jan Kneschke ([email protected])
Copyright 2019 Josef Patoprsty ([email protected])
Licensed under the same license as Lua 5.1
This is an alteration of the original lua-callgrind by Jan Kneschke.
Features:
@1bardesign
1bardesign / stable_sort.lua
Last active June 8, 2025 18:51
stable sorting routines for lua
-- stable sorting routines for lua
--
-- modifies the global table namespace so you don't have
-- to re-require it everywhere.
--
-- table.stable_sort
-- a fast stable sort
-- table.unstable_sort
-- alias for the builtin unstable table.sort
-- table.insertion_sort
@1bardesign
1bardesign / oo.lua
Last active February 6, 2019 04:41
state management code - fsm and a push/pop "game state manager" - see state_machine.lua for the main interesting bit
--[[
oop basics
]]
function class(inherits)
local c = {}
c.__mt = {__index = c}
--handle single inheritence
if type(inherits) == "table" and inherits.__mt then
setmetatable(c, inherits.__mt)
local ffi = require "ffi"
ffi.cdef [[
typedef struct {
float x;
float y;
} vector;
]]
local storage_size = 8096
@josefnpat
josefnpat / slider.lua
Created October 10, 2018 19:30
Slider Library
--[[
Copyright (c) 2018, Josef Patoprsty
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 so, subject to the following
--sort core
--
-- stable sorting routines for lua
--
--based on MIT licensed code from Dirk Laurie and Steve Fisher
--license as follows:
--[[
Copyright © 2013 Dirk Laurie and Steve Fisher.