Skip to content

Instantly share code, notes, and snippets.

View paulschwarz's full-sized avatar

Paul Schwarz paulschwarz

View GitHub Profile
<?php
class FooValidator implements Validator
{
public function __construct(Validator $validator)
{
$this->validator = $validator
$this->validator->rule('name', 'not_empty')
->rule('name', 'max_length', [':value', 35])
->rule('name', 'min_length', [':value', 5]);
@paulschwarz
paulschwarz / bootstrap_chef.bash
Created June 22, 2012 19:55 — forked from chrismdp/bootstrap_chef.bash
Bootstrap Chef Solo on Ubuntu
#!/usr/bin/env bash
# call like this on the target server:
# CHEFREPO='git://github.com/paulsschwarz/vagrant-cookbooks.git' CHEF_ENV='production' bash <( curl -L https://raw.github.com/gist/2974764 )
set -e
export RUBYGEMS_VERSION="1.8.24"
export CHEF_DIR="${HOME}/chef"
sudo rm -rf $CHEF_DIR
mkdir -p "$CHEF_DIR"
@kemo
kemo / Security.php
Created May 6, 2012 20:57
My Kohana 3.3 Security class with CSRF Validation helper method
<?php defined('SYSPATH') or die('No direct script access.');
class Security extends Kohana_Security {
protected static $_logout_token_name = 'logout_token_key';
public static $csrf_field = 'token';
/**
* Creates a validation object to check if the field specified