Skip to content

Instantly share code, notes, and snippets.

View geekhunger's full-sized avatar

geekhunger geekhunger

View GitHub Profile
@geekhunger
geekhunger / Hook.lua
Last active April 15, 2016 14:20
Easy Backups in Codea.
--# Hook
local s_setup
debug.sethook(function(event)
if setup and setup ~= s_setup then
local o_setup = setup
setup = function()
debug.sethook()
if hook then hook() end
o_setup()
end
@geekhunger
geekhunger / Color.lua
Last active August 29, 2015 14:06
Simplified Painting App, made with Codea.
--# Color
-- modified version from https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua
--[[
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
@geekhunger
geekhunger / PixelboyUndoRedoSnippets.lua
Last active August 29, 2015 14:11
Full Source Of Pixelboy
--# Main
-------------------------------------------------------------- NAMESPACES
local Touches = {}
local Frames = {}
local CurrentFrame = 0
local Action = {}
local Actions, CurrentAction = {}
@geekhunger
geekhunger / main.lua
Created January 17, 2015 16:11
Codea deviceShaking() function
-- Accelometer Shake
supportedOrientations(LANDSCAPE_RIGHT)
function setup()
print("Shake a few times until the rect() exceeds the ellipse().")
end
local function deviceShaking()
local acceleration = UserAcceleration
@geekhunger
geekhunger / LineCaps.lua
Last active November 19, 2015 11:57
Fake lineCapMode() for line(), when noSmooth() is activated in Codea.
local _line = line
local function lineCap(d)
for x = 1, d do
y = math.sqrt(d*d - x*x)
rect(0, 0, x, y)
end
end
function line(x1, y1, x2, y2, capMode)
@geekhunger
geekhunger / page.hbs
Created January 26, 2015 11:14
Ghost - List of posts inside post.hbs and page.hbs
...
{{> posts_list}}
...
@geekhunger
geekhunger / LineCaps.lua
Created November 20, 2015 17:45
Initial commit
local _line = line
local function lineCap(d)
for x = 1, d do
y = math.sqrt(d*d - x*x)
rect(0, 0, x, y)
end
end
function line(x1, y1, x2, y2, capMode)
@geekhunger
geekhunger / Main.lua
Created January 23, 2016 21:10
Procreate Animation Player. Tool wrote in Codea.
--# Main
-- Procreate Animation Player [v1]
-- (c) kennstewayne.de
--
-- Works only with Dropbox for now!
--
displayMode(FULLSCREEN)
function setup()
@geekhunger
geekhunger / Main.lua
Created December 22, 2017 23:46
Codea CraftAR example. Place window frames which display your current camera feed.
--# Main
supportedOrientations(LANDSCAPE_ANY)
displayMode(OVERLAY)
function setup()
    scene = craft.scene()
@geekhunger
geekhunger / Main.lua
Last active February 20, 2020 07:36
This is a MySQL Adapter for Codea + demo code. It lets your Codea app talk directly to a MySQL server.
--# Main
-- mysql adapter
--
-- TODO: write higher level API to mysql
-- app should cache inputs and push to mysql when server available
-- also queries should be wrapped in coroutines or something, to be async?
function setup()