Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View zeelot's full-sized avatar

zeelot zeelot

  • Microsoft Research
  • Seattle
View GitHub Profile
@zeelot
zeelot / Router.php.diff
Created October 13, 2012 23:23
trying to fix #4113
diff --git a/classes/Kohana/Route.php b/classes/Kohana/Route.php
index fdd2e1b..d8e33fe 100644
--- a/classes/Kohana/Route.php
+++ b/classes/Kohana/Route.php
@@ -531,8 +531,12 @@ class Kohana_Route {
return rtrim($params['host'], '/').'/'.$uri;
}
+ // Keep track of whether an optional param was replaced
+ $provided_optional = FALSE;
@zeelot
zeelot / url.php
Created August 29, 2012 16:08
Fix for security issue in Kohana 3.0.8 - 3.2.1
<?php defined('SYSPATH') or die('No direct script access.');
// Just use this file in application/classes/url.php for a fix until 3.2.2 is out
class URL extends Kohana_URL {
/**
* Fetches an absolute site URL based on a URI segment.
*
* echo URL::site('foo/bar');
*
@zeelot
zeelot / classes-view-page-browse.php
Created March 27, 2012 04:17
Top navigation with selected status (change dashes for slashes as gists do not allow directories)
<?php
Class View_Page_Browse extends View_Page {
// On this page, 'browse' tab is selected
protected $_selected_top_nav_item = 'browse';
}
@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'),
@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'))),
),
<?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 / 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
@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 / 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 / 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)