Skip to content

Instantly share code, notes, and snippets.

@pablophg
pablophg / roundedbutton.xml
Created January 16, 2015 11:28
Android button with round corners
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#eeffffff" />
<corners android:bottomRightRadius="8dip"
android:bottomLeftRadius="8dip"
android:topRightRadius="8dip"
android:topLeftRadius="8dip"/>
</shape>
@pablophg
pablophg / class.lua
Created December 22, 2014 08:41
SimpleLuaClasses
-- check "http://lua-users.org/wiki/SimpleLuaClasses" for this file
-- class.lua
-- Compatible with Lua 5.1 (not 5.0).
function class(base, init)
local c = {} -- a new class instance
if not init and type(base) == 'function' then
init = base
base = nil
-- By Saml1er, for research :P
Testaz = { }
function Testaz:new (o,a,b)
setmetatable(o, self)
self.__index = self
self.str = tostring (a + b)
return o
@pablophg
pablophg / sandbox.lua
Created November 9, 2014 07:51
Lua sandbox
local user_script = loadstring('print("hello")')
local env = {print=print}
setfenv(user_script, env)
pcall(user_script)
@pablophg
pablophg / prettyround.lua
Last active December 30, 2015 03:19
Function that rounds a number to 2 decimals and returns it as string.
function prettyround(number)
return string.format('%.2f', number)
end