Skip to content

Instantly share code, notes, and snippets.

View pablomayobre's full-sized avatar
📖
Learning new technologies

Pablo Ariel Mayobre pablomayobre

📖
Learning new technologies
  • NewCombin
  • Trelew, Chubut, Argentina
View GitHub Profile
@gvx
gvx / defdef.lua
Created February 16, 2009 13:59
default definitions for Lua
-- defdef.lua
-- default definitions for lua
-- By Robin Wellner (gvx)
-- I hereby waive copyright and related or neighboring rights to this work
-- See the Creative Commons Zero Waiver at <http://creativecommons.org/publicdomain/zero/1.0/>
-- Evaluate truth like in Python
function is_true (arg)
if arg == '' or arg == 0 then
@Deco
Deco / deepcopy.lua
Created October 31, 2012 05:38
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO
@kikito
kikito / grid.lua
Created May 29, 2014 12:48
Grid traversal
local grid = {}
local function grid_toCell(cellSize, x, y)
return math.floor(x / cellSize) + 1, math.floor(y / cellSize) + 1
end
-- grid_traverse* functions are based on "A Fast Voxel Traversal Algorithm for Ray Tracing",
-- by John Amanides and Andrew Woo - http://www.cse.yorku.ca/~amana/research/grid.pdf
-- It has been modified to include both cells when the ray "touches a grid corner",
-- and with a different exit condition
@josefnpat
josefnpat / slg09x-run.sh
Created July 10, 2014 18:13
Starfire Lords: Genesis run script for LÖVE
#!/bin/sh
# Copyright (c) 2014 Josef Patorpsty
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
@nolanlawson
nolanlawson / Dexie.min.js
Created February 7, 2015 18:01
IndexedDB+Dexie+Lunr MTG full-text search demo
(function(n,t,i,r){"use strict";function h(n,t){return typeof t!="object"&&(t=t()),Object.keys(t).forEach(function(i){n[i]=t[i]}),n}function y(n){return{from:function(t){return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,{extend:function(i){h(n.prototype,typeof i!="object"?i(t.prototype):i)}}}}}function p(n,t){return t(n)}function f(t){function or(){if(i)w.on("versionchange",function(t){w.close();t.newVersion&&n.location.reload(!0)})}function ki(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null};this.stores({})}function sr(n,t,i,r){var e,f,o,h,l,c;if(n==0)Object.keys(pt).forEach(function(n){di(t,n,pt[n].primKey,pt[n].indexes)}),e=w._createTransaction(kt,ri,pt),e.idbtrans=t,e.idbtrans.onerror=s(i,["populating database"]),e.on("error").subscribe(i),u.newPSD(function(){u.PSD.trans=e;try{w.on("populate").fire(e)}catch(n){r.onerror=t.onerror=function(n){n.preventDefault()};try{t.abort()}catch(f){}t.db.close();i(n)}});else{if(f=[],o=ii.filter(function(t){return
@SoniEx2
SoniEx2 / clex.md
Last active December 18, 2016 02:31

ClEx - Clunky Expressions

Version 0.10.

Authors:

  • SoniEx2

About

@inmatarian
inmatarian / funky.lua
Last active June 13, 2016 23:38
latest version of funky.lua
-- Funky.lua, collection of functional tools
local _ENV = setmetatable({}, {__index = _ENV or _G})
if setfenv then setfenv(1, _ENV) end
unpack = unpack or table.unpack
local __ = {}
do
-- We need a fast way to check for placeholders. All funkier libraries
-- will need to register themselves as a funky placeholder.
@novemberborn
novemberborn / howto.md
Created February 18, 2016 17:47
Creating a PKCS#12 file from a Let's Encrypt certificate
@kikito
kikito / gui.txt
Last active June 8, 2016 04:51
rummagings about gui design
An UI has several parts:
1. The "Layout": Defines the space each control takes. "This button is 32x32 px and is located in 100,100"
2. The "Function": what happens when a control is used. "This needs to happen when this button is pressed"
3. The "Skin": how each control is displayed. "This button, with this state, is a red circle"
4. Bells and whistles: Things like state animations, or playing a sound when a button is hovered.
5. Current focus.
6. A way to handle input: Move focus to next item. "There is a pointer pressing on this position".
Problems:
local function check (self)
if not self.isDirty then
return self
end
self.length = 0
local item = self.firstItem
while item do
self.length = self.length + 1
self.items[self.length] = item
item = self.itemAfter[item]