Skip to content

Instantly share code, notes, and snippets.

View zeelot's full-sized avatar

zeelot zeelot

  • Microsoft Research
  • Seattle
View GitHub Profile
# HTTPDOCS .htaccess
# Created by Redirection Module: Apache
# Thu, 06 Aug 2009 13:14:48 -0400
# Redirection 2.1.22 - http://urbangiraffe.com/plugins/redirection/
<Files .htaccess,.svn>
order allow,deny
deny from all
</Files>
<?php defined('SYSPATH') or die('No direct script access.');
class TicketsCommentsStatusesLabels extends Doctrine_Migration_Base
{
public function up()
{
// Types
$int = array('type' => 'integer', 'length' => 8);
$varchar = array('type' => 'varchar', 'length' => 255);
$text = array('type' => 'text');
<?php
try
{
$test = ARB::cancel()
->test_mode(TRUE)
->set('subscription_id' => '924332')
->execute();
}
catch (ARB_Validation_Exception $e)
{
@zeelot
zeelot / Model_Test.php
Created October 31, 2010 03:02
saving related orm models with new ORM_Validation_Exception class
<?php
public function save(Validate $validate = NULL)
{
DB::query(NULL, 'START TRANSACTION')->execute();
try
{
parent::save($validate);
}
catch (ORM_Validation_Exception $e)
@zeelot
zeelot / view_model.php
Created April 6, 2011 18:15
Wrapper for ORM models to add view logic on top
<?php defined('SYSPATH') or die('No direct script access.');
class View_Model
{
public static function factory(Model $model)
{
// Get the associated View_ name (ex: View_Model_User)
$class = 'View_'.get_class($model);
if (class_exists($class))
@zeelot
zeelot / miniond
Created July 26, 2011 21:10
miniond (for long running minion tasks)
#!/bin/bash
#
# This script is similar to minion but will do a few additional things:
# - PHP process is run in the background
# - PHP process is monitored and restarted if it exits for any reason
# - Added handlers for SUGHUP, SIGINT, and SIGTERM
#
# This is meant for long running minion tasks (like background workers).
# Shutting down the minion tasks is done by sending a SIGINT or SIGTERM signal
# to this miniond process. You can also restart the minion task by sending a
@zeelot
zeelot / miniond
Created July 27, 2011 01:25
miniond (for long running minion tasks)
#!/bin/bash
#
# This script is similar to minion but will do a few additional things:
# - PHP process is run in the background
# - PHP process is monitored and restarted if it exits for any reason
# - Added handlers for SUGHUP, SIGINT, and SIGTERM
#
# This is meant for long running minion tasks (like background workers).
# Shutting down the minion tasks is done by sending a SIGINT or SIGTERM signal
# to this miniond process. You can also restart the minion task by sending a
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package OAuth2
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
*/
@zeelot
zeelot / bla.php
Created August 21, 2011 18:03 — forked from kiall/bla.php
Valid::at_least()
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Bla extends ORM {
public function rules()
{
return array(
'phone_one' => array(
array('at_least', array(':validation', 1, array('phone_one', 'phone_two', 'phone_three'))),
),
@zeelot
zeelot / example.php
Created August 24, 2011 20:52
Possible minion options definition
<?php
// 1 Property
class Minion_Task_Example extends Minion_Task {
protected $_options = array(
'force' => array(
'default' => NULL,
// Defaults to --{{key}} (--force in this case)
'names' => array('--force', '-f'),