Skip to content

Instantly share code, notes, and snippets.

@tony-landis
tony-landis / smarty.function.soap.php
Created December 3, 2008 07:23
Smarty Soap Plugin (PHP)
<?php
/**
* Smarty {soap} plugin
*
* Type: function<br>
* Name: soap<br>
* Purpose: post http data and display results from soap webservice
* Params: url, post(true/false - passes along orig params), assign,
* Usage: {soap assign=soapResponse
* endpoint=http://www.site.com/search.soap
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
#!/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
*/
@tony-landis
tony-landis / pdo-singleton-class.php
Created December 3, 2008 07:36
PHP PDO Singleton Class
<?php
/**
* PDO SINGLETON CLASS
*
* @author Tony Landis
* @link http://www.tonylandis.com
* @license Use how you like it, just please don't remove or alter this PHPDoc
*/
class sdb
@tony-landis
tony-landis / CsvToArray.py
Created December 5, 2008 18:03
Convert CSV string to fixed width text table
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
@tony-landis
tony-landis / couch-replicate-monitor.py
Created October 27, 2012 19:20
Simple script you can put in your crontab to monitor replication state of all docs in the _replicator couchdb database. Will send an email with the host name, doc name and state if state is not 'triggered'.
#!/usr/bin/python
"""
Simple script you can put in your
crontab to monitor replication state
of all docs in the _replicator
couchdb database.
Will send an email with the host name,
doc name and state if state is not 'triggered'.
// some data used in the examples
Ext.namespace('Ext.exampledata');
Ext.exampledata.states = [
['AL', 'Alabama', 'The Heart of Dixie'],
['AK', 'Alaska', 'The Land of the Midnight Sun'],
['AZ', 'Arizona', 'The Grand Canyon State'],
['AR', 'Arkansas', 'The Natural State'],
['CA', 'California', 'The Golden State'],
['CO', 'Colorado', 'The Mountain State'],
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):
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
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,