Skip to content

Instantly share code, notes, and snippets.

View kanema's full-sized avatar

Eduardo Pacheco kanema

View GitHub Profile
Light = {}
Light.__index = Light
function Light.create(light, switch)
local instance = {}
setmetatable(instance, Light)
instance.name = "light" .. light
instance.light = light
@kanema
kanema / orm.php
Created April 27, 2011 03:41
kohana orm dynamic finder
class ORM extends Kohana_ORM {
/**
* Dynamic Finder:
* $orm->find_by_name('eduardo');
* $orm->find_all_by_name('eduardo');
* $orm->count_by_name('eduardo');
* $orm->find_all_by_name_or_email('eduardo');
* $orm->find_all_by_name_and_email('eduardo', 'du@kanema.com.br');
* $orm->find_all_by_name_and_email_and_is_active('eduardo', 'du@kanema.com.br', TRUE);