Skip to content

Instantly share code, notes, and snippets.

Joel Schumacher pfirsich

Block or report user

Report or block pfirsich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pfirsich / setColor.lua
Created Oct 17, 2018 compatibility monkeypatch for migrating from love 0.10.2 to 11+
View setColor.lua
local oldSetColor =
function, g, b, a)
if type(r) == "table" then
assert(#r == 3 or #r == 4)
assert(g == nil and b == nil and a == nil)
r, g, b, a = unpack(r)
assert(type(r) == "number" and type(g) == "number" and type(b) == "number")
pfirsich / static_var_default.cpp
Last active Oct 1, 2018
A function `getVar` that gets the value of a static variable inside a class (template argument) and returns a default value, if that static variable is not present.
View static_var_default.cpp
#include <iostream>
using VarType = int;
const VarType DEFAULT_VAR = 0;
struct doesHaveVar {
static const VarType var = 1;
struct doesNotHaveVar {
pfirsich / bitmask.lua
Created Aug 26, 2018
A LuaJIT bitmask class (like std::bitset)
View bitmask.lua
local bit = require("bit")
local band, bor, bxor, bnot, lshift =, bit.bor, bit.bxor, bit.bnot, bit.lshift
local function pot(n) -- power of two
return lshift(1, n)
local BitMask = setmetatable({}, {__call = function(t, ...)
local self = setmetatable({}, t)
pfirsich / pot_bench.lua
Created Aug 25, 2018
Power of Two function benchmark for luajit (löve used for timing)
View pot_bench.lua
local potLut = {}
potLut[0] = 1
for i = 1, 32 do
potLut[i] = potLut[i-1] * 2
-- compare this with lshift(2, n)
local function potA(n) -- power of two
return potLut[n]
pfirsich / _hybrid.lua
Last active Aug 23, 2018
Sketches for high-level library for kaun (chu)
View _hybrid.lua
-- resources (kaun)
local paddleMesh = kaun.newMesh("paddle.obj")
local paddleTexture = kaun.newTexture("paddle.png")
local ballMesh = kaun.newSphereMesh(1.0, 12, 12)
local ballTexture = kaun.newTexture("ball.png")
local level = kaun.newMesh("level.obj")
local skyboxMesh = kaun.newBoxMesh(1, 1, 1)
pfirsich /
Last active Jul 16, 2018
Documentation for Controll Config Scripts in Spectacular Shatter Buddies (

Control Config Scripts (*.sbcs)


For syntax highlighting you can usually use JavaScript or C syntax highlighting.

The configs you find in the save directory in control_configs will be overwritten every time you restart the game. If you want to make a custom control script, you need to create a copy with a different name.

Sadly if there is a syntax error in these scripts, the script will be parsed up until that error without notifying you, so that you will have only partially working controls!

General Syntax

pfirsich / main.lua
Created Jul 6, 2018
Trace blobs in images to approximate polygons around them. Done for @MaChue on the löve Discord server. Images are here:
View main.lua
local trace = require("trace")
local imageIndex = 1
local image
local outline
local boundingBox
function updateBoundingBox(padding)
-- minX, minY, maxX, maxY
boundingBox = {math.huge, math.huge, 0, 0}
import os
import sys
cmd = 'ffmpeg -r 60 -i "{dirName}/%d.png" -y -c:v libx264 -vf "format=yuv420p" -r 60 "{dirName}.mp4"'
for dirName in os.listdir("."):
if os.path.isdir(dirName) and (len(sys.argv) <= 1 or dirName in sys.argv[1:]):
View Signal.hpp
#include <cstdio>
#include <vector>
#include <functional>
// eraz on ##c++@freenode helped me with this, by pointing me to std::function!
// Here we use std::function like template syntax, by defining a generic Signal and
pfirsich / spacewalk.lua
Created Nov 5, 2015
Simple example of an entity type description file for Screwdriver (shown in my blog). The beginning for a hypothetical full remake of Spacewalk.
View spacewalk.lua
entityTypes["levelGeometry"] = {
label = "Level geometry",
components = {
id = "core",
componentType = "Core", -- every entity type has to have a core component
id = "transforms",
componentType = "Transforms",
You can’t perform that action at this time.