Skip to content

Instantly share code, notes, and snippets.

@LPGhatguy
LPGhatguy / CubeTimer.lua
Created June 19, 2013 00:13
The source for a cube timer application.
--[[
Cube Timer
Version 3.1
]]
local start_keys = {"lctrl", "ralt"}
local start_keys_down = {false, false}
local keys_down = false
local keys_down_last = false
@LPGhatguy
LPGhatguy / cube.js
Last active December 18, 2015 16:19
This is the official WCA Cube Scrambling JavaScript source, taken from http://www.jaapsch.net/scramble_cube.htm.
var size=3;
var seqlen=30;
var numcub=5;
var mult=false;
var cubeorient=false;
var colorString = "yobwrg"; //In dlburf order. May use any colours in colorList below
// list of available colours
var colorList=new Array(
'y', "yellow", "yellow",
@LPGhatguy
LPGhatguy / luby.lua
Created June 19, 2013 00:37
This is a fun thing that allows select Ruby code (namely loops with ranges) to execute as valid Lua code.
--Luby 1.0
function construct_iterator(n)
local at = 0
return function()
at = at + 1
return n[at]
end, n
end
@LPGhatguy
LPGhatguy / format.lua
Created December 31, 2013 05:29
LDOC Prototype. Produces HTML-formatted documentation from Lua comments. See http://hastebin.com/nexedayeqo.lua for example input code. This is taken from my personal stash of utility scripts and isn't guaranteed to be decent. util.lua is the library's utility set (one function?) parser.lua parses the comments and forms a document tree. output.l…
return {
["html"] = {
value_process = function(source)
if (type(source) == "string") then
return source:gsub("\n", "\n<br />")
else
return source
end
end,
extension = ".html",
@LPGhatguy
LPGhatguy / minify.lua
Last active January 1, 2016 19:59
Minifies Lua from the command line.
--[[
Lua Minify 1.0
Usage:
lua minify.lua comments DIRECTORY
strips comments from all .lua files in the directory, recursively, and puts them in DIRECTORY/minified
lua minify.lua minify DIRECTORY
strips comments and minifies code from all .lua files and places them like the prior command.
]]
@LPGhatguy
LPGhatguy / build-love.sh
Created March 20, 2014 05:38
Builds LOVE on Fedora 20. Requires the shell to be in the extracted LOVE's directory and that libmpg123 is installed (because it isn't in Fedora's package manager)
echo LOVE Install for Fedora Initialized
pause
yum install gcc gcc-c++ automake libtool SDL2 SDL2-devel openal openal-devel luajit luajit-devel DevIL DevIL-devel freetype-devel libmodplug libmodplug-devel physfs physfs-devel libvorbis-devel
platform/unix/automagic
./configure
make
make install
echo Complete!
@LPGhatguy
LPGhatguy / graph.lua
Last active August 29, 2015 13:57
Graph Prototype 1 - displays a few graphs in a demo graphing window
--[[
PUBLIC DOMAIN
Where this designation is not recognized, you are
permitted to copy, modify, and distribute this code
without restriction.
Lucien Greathouse
(LPGhatguy)
]]
@LPGhatguy
LPGhatguy / synth.lua
Last active August 29, 2015 13:57
Synthesizer Prototype 2 - A synthesizer for an organ without need for any assets. Use the keys 1Q2W3ER5T6YU8I9O0P[=], backspace, \ZSXDCVGBHNM,L.;/, and right shift to play it.
--[[
PUBLIC DOMAIN
Where this designation is not recognized, you are
permitted to copy, modify, and distribute this code
without restriction.
Lucien Greathouse
(LPGhatguy)
]]
@LPGhatguy
LPGhatguy / notimagefontfont.lua
Created April 3, 2014 03:28
Generates a bitmap version of love's default font with an outline.
local infont
local outfont
local glyphstring = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`~!@#$%^&*()-=_+[]{}\\|;:'\",./<>?"
local teststring = [[
Who packed five dozen old quart jugs in my box?
Prating jokers quizzically vexed me with fibs.
Brawny gods just flocked up to quiz and vex him.
Watch "Jeopardy!", Alex Trebek's fun TV quiz game.
]]
local border = 2
@LPGhatguy
LPGhatguy / oops.lua
Created April 25, 2014 19:57
Creates an insane development environment.
--usage: require("oops")
local rawset, tostring = rawset, tostring
local meta = {
__mode = "v",
__index = function(self, index)
return tostring(index)
end,
__newindex = function(self, index, value)
rawset(self, tostring(index):upper(), value)
end