Skip to content

Instantly share code, notes, and snippets.

@tony-landis
tony-landis / gist:33018
Created December 7, 2008 02:45
Lua for Lighttpd to rewrite to a handler script if cached copy of requested file is missing
cache_path = "/var/www/site/tmp"
cache_code = "compile"
-- render and cache to the filesystem
function cache_gen()
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. "/index.php"
lighty.env["uri.query"] = "p=" .. string.gsub(lighty.env["uri.path"], "\.(htm|html)$", "")
--print ("CACHE: " .. lighty.env["uri.query"])
end
<?php
require "../includes/smarty/Smarty.class.php";
$smarty = new Smarty;
$smarty->template_dir = 'templates';
$smarty->compile_dir = 'compile';
$smarty->cache_dir = '/var/www/site/tmp';
$smarty->caching = true;
$smarty->force_compile = true;
/**
* Provides a drop down field with multiple checkboxes
* @author Tony Landis http://www.tonylandis.com/
* @copyright Free for all use and modification. The author and copyright must be remain intact here.
*
* @class Ext.form.MultiSelectField
* @extends Ext.form.TriggerField
*/
Ext.form.MultiSelectField = Ext.extend(Ext.form.TriggerField, {
triggerClass: 'x-form-trigger',
#!/usr/bin/php -q
<?php
/**
* ASTERISK PBX VOICEMAIL MAILER
*
* @author Tony Landis
* @link http://www.tonylandis.com
* @license Use how you like it, just please don't remove or alter this PHPDoc
*/
CREATE DATABASE `pylons_openid`;
USE pylons_openid;
CREATE TABLE `user` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(128) default NULL,
`password` varchar(128) default NULL,
`acl` varchar(16) NOT NULL,
`name` varchar(32) default NULL,
from sqlalchemy.orm import *
from sqlalchemy import Table, Column, ForeignKey, Integer
from sqlalchemy.types import Integer, Unicode, String, DateTime
from pylons_openid.model import meta
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
meta.Session.configure(bind=engine)
meta.engine = engine
from sqlalchemy.orm import *
from sqlalchemy import Table, Column, ForeignKey, Integer
from sqlalchemy.types import Integer, Unicode, String, DateTime
from pylons_openid.model import meta
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
meta.Session.configure(bind=engine)
meta.engine = engine
__all__ = ["get_id", "require_login", "require_admin", "require_customer"]
from pylons.controllers.util import abort, redirect_to, url_for
from pylons import session
from decorator import decorator
_group_admin = ['admin']
_group_customer = ['admin','customer']
def get_id():
import logging
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
from pylons_openid.lib.base import BaseController, render
log = logging.getLogger(__name__)
from pylons_openid.lib.auth import *
class RootController(BaseController):
import logging
from pylons import config, request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, url_for
from pylons_openid.lib.base import BaseController, render
log = logging.getLogger(__name__)
import urllib2
import md5
import simplejson as json_