Skip to content

Instantly share code, notes, and snippets.

View ixti's full-sized avatar
😂
forever blowing bubbles

Alexey Zapparov ixti

😂
forever blowing bubbles
View GitHub Profile
<?php // file: library/App/Record.php
abstract class App_Record extends Doctrine_Record
{
public function setUp()
{
$this->unshiftFilter(new App_Record_Filter_Date);
}
<?php // file: library/App/Record/Filter/Date.php
/** Doctrine_Record */
require_once 'Doctrine/Record.php';
/** Doctrine_Record_Filter */
require_once 'Doctrine/Record/Filter.php';
<?php //file: application/modules/admin/controllers/IndexController.php
class Admin_IndexController extends Zend_Controller_Admin
{
public function init()
{
$request = $this->getRequest();
$auth = App_Auth_Admin::getInstance();
if (!$auth->hasIdentity() && ('login' !== $request->getActionName())) {
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
// ...
protected function _initSession()
{
$front = $this->bootstrap('FrontController')
->getResource('FrontController');
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initFrontController()
{
$front = ($this->hasPluginResource('FrontController'))
? $this->getPluginResource('FrontController')->init()
: Zend_Controller_Front::getInstance();
$front ->setRequest(new Zend_Controller_Request_Http());
<?php //file: library/Application/Controller/Plugin/ModularAuth.php
class Application_Controller_Plugin_ModularAuth extends Zend_Controller_Plugin_Abstract
{
protected $groups;
public function __construct($groups = array())
{
<?php
class RS_Auth_Adapter implements Zend_Auth_Adapter_Interface
{
const NOT_FOUND_MSG = 'Account not found';
const BAD_PW_MSG = 'Password in invalid';
protected $user = null;
@ixti
ixti / config
Created November 28, 2010 21:26 — forked from edavis10/config
svn to git redmine sync
#
# Core Redmine sync
#
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[instaweb]
local = true
@ixti
ixti / array-example.js
Created February 16, 2011 11:04
Showing some unexpected behavior of arrays in JS
var sys = require('sys'),
arr = [];
// fill with 100 dummy items
for (var i = 0; i < 100; ++i) arr.push('test');
// delete first 99 dummy items
for (var i = 0; i < 99; ++i) delete(arr[i]);
// add one item more
@ixti
ixti / extension.js
Created April 30, 2011 23:51
Node.JS vm's global sandbox bug (although they call it feature)...
// Let's extend prototype of Object with something like delete in ruby, but
// we'll call it grab (just to avoid keyword name collision)
Object.prototype.grab = function grab(key) {
var val = this[key];
delete(this[key]);
return val;
};