Skip to content

Instantly share code, notes, and snippets.

function listTable(tbl, prefix)
local prefix = prefix or ""
for i,t in pairs(tbl) do
if type(t) == "table" then listTable(t, prefix.."."..i)
elseif type(t) == "function" then print(prefix.."."..i) end
end
end
function love.load()
listTable(love, "love")
love=${HOME}/.bin/love # location of love binary
zip=/usr/bin/zip # location of zip
luac=/usr/bin/luac # location of luac
# name of the .love
game=
# source files. if you have subdirectories, add */*.lua
sources=*.lua
# resource files like images, fonts and sounds.
res=
// ==UserScript==
// @include *love2d.org/forums/viewtopic.php*
// ==/UserScript==
(function(){
function getElementsByTagAndClass(tag, cls) {
var tags = document.getElementsByTagName(tag);
var ret = [];
for (var i = 0; i < tags.length; ++i) {
if (tags[i].className.indexOf(cls) > -1)
ret.push(tags[i]);
// ==UserScript==
// @include *love2d.org/forums/viewtopic.php*
// ==/UserScript==
(function() {
var users = []; // the users to hide automatically
function getElementsByTagAndClass(tag, cls) {
var tags = document.getElementsByTagName(tag);
var ret = [];
@vrld
vrld / gist:755487
Created December 26, 2010 15:53
Opera Speed Dial like thing for luakit
local chrome = require "chrome"
local capi = { luakit = luakit }
local page = "chrome://favs/"
local pattern = page.."?"
local cutycapt_bin = "/home/matthias/.bin/CutyCapt"
local html_template = [====[
<html>
@vrld
vrld / example.cpp
Created November 27, 2012 13:16
Helpers for exposing (parts of) C++ structs to Lua, e.g. to be passed around in "glue code"
#include <lua_proxy.hpp>
#include <opencv.hpp>
// Exposing cv::Mat to Lua
template<> struct LuaXTraits<cv::Mat>
{
constexpr static const char *name()
{
return "Type.cv::Mat";
@vrld
vrld / example.cpp
Created November 27, 2012 13:27
Less annoying luaL_Buffer handling in C++
int l_imwrite(lua_State *L)
{
// see https://gist.github.com/4154182
cv::Mat *img = LuaProxy<cv::Mat>::get(L, 1);
const char *path = luaL_checkstring(L, 2);
if (cv::imwrite(path, *img))
{
lua_pushboolean(L, true);
return 1;
@vrld
vrld / grains.lua
Created December 13, 2012 11:35
Grain synthesis with LHC.
local lhc = require 'lhc'
local SAMPLERATE = 44100
local generator = {
sine = function(x) return math.sin(x * 2 * math.pi) end,
tri = function(x) x = (x-.5)%1 return math.min(2*x-1, 1-2*x) end,
saw = function(x) return (2*x-1)%2 - 1 end,
rect = function(x) return 2 * math.floor((2*x)%2) -1 end,
wn = function(x) return math.random() end,
@vrld
vrld / gist:5166463
Created March 15, 2013 00:14
make love
love=$(/usr/bin/env love)
zip=$(/usr/bin/env zip)
luac=$(/usr/bin/env luac)
# path to win and osx distributions
windir=~/Stuff/love-win-x86
osxapp=~/Stuff/love.0.8.app
game=TITLE-OF-THE-GAME.love
@vrld
vrld / aix
Created May 29, 2013 16:53
Quick hack to get a more comfortable search tool on APT-based distros. Inspired by gentoo's wonderful `eix'.
#!/usr/bin/python
class AnsiColor:
default = '\033[00;30m'
bold = '\033[01;30m'
green = '\033[00;32m'
boldgreen = '\033[01;32m'
boldred = '\033[01;31m'
pass