Skip to content

Instantly share code, notes, and snippets.

View Bigfoot71's full-sized avatar
👾

Le Juez Victor Bigfoot71

👾
View GitHub Profile
// This code is distributed under the Unlicense license.
// For more details, please visit https://unlicense.org/
template <class T>
class CircularBuffer
{
private:
std::unique_ptr<T[]> buffer;
size_t frontIndex;
size_t backIndex;
@Bigfoot71
Bigfoot71 / formatShader.lua
Last active June 24, 2023 01:03
Lua script (>=5.1) to convert a GLSL shader into a C string.
local function formatString(inputString)
local outputString = ""
for line in inputString:gmatch("[^\r\n]+") do
if line:match("%S") then -- Check if row is empty
local formattedLine = line:gsub("^%s*", "") -- Remove spaces before the first character of the line
@Bigfoot71
Bigfoot71 / AndroidManifest.xml
Last active February 21, 2024 01:04
Example of AdMob integration in Raymob
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- Add this for apps targeting Android 13 or higher & GMA SDK version 20.3.0 or lower -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<application>
@Bigfoot71
Bigfoot71 / display.lua
Created April 17, 2023 21:23
Script to handle display resizing in Löve2D
local lg = love.graphics
local Display = {
size = {
w = 0,
h = 0,
ox = 0,
oy = 0
};
@Bigfoot71
Bigfoot71 / example.lua
Created November 10, 2022 15:03
table.partition function, to divide a table into 'n' tables or 'n' by 'n' (only works with tables with a numeric index starting from [1])
require("table-partition.lua")
do -- Dividing a table with a length of 167 into 7 tables
local TBL = {}
for i = 1, 167 do TBL[i] = i end
local TBLS = table.partition(TBL, 7)
@Bigfoot71
Bigfoot71 / moonscript_lua_compiler.lua
Created October 26, 2022 13:45
Script I use to compile Moonscript code to Lua.
local parse = require "moonscript.parse"
local compile = require "moonscript.compile"
local function getLine(msg)
io.write(msg or "> ")
return io.read("*l")
end
local function getChoice(msg, ...)
@Bigfoot71
Bigfoot71 / timeTest.lua
Last active October 26, 2022 13:49
Execution time test function (Lua)
local timeTest = function(f, ...)
local t1, r, t2 = os.clock(), f(...), os.clock()
print(string.format("The function took %0.6f seconds to run", t2 - t1))
return r
end
return timeTest