Skip to content

Instantly share code, notes, and snippets.

View AV4TAr's full-sized avatar

Diego Sapriza AV4TAr

View GitHub Profile
@AV4TAr
AV4TAr / gist:1271117
Created October 7, 2011 19:09
Loading application configuration from View Action
<?php
class MyController extends Zend_Controller_Action {
//...
public function myAction(){
$bootstrap = $this->getInvokeArg('bootstrap');
$config_options = $bootstrap->getOptions();
}
}
@AV4TAr
AV4TAr / Bootstrap.php
Created October 7, 2011 19:00
Use Bootstrap to load configuration file in Zend_Application
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
//...
protected function _initConfig(){
$config_options = new Zend_Config($this->getOptions());
Zend_Registry::set('config', $config_options);
return $config_options;
}
}
<?php
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$config_options = $bootstrap->getOptions();
diego$ git branch
* diego
master
@AV4TAr
AV4TAr / gist:1309726
Created October 24, 2011 18:27
Merge one file to a branch
git checkout <branch_you_want_to_merge_from> <file_paths_to_merge...>
@AV4TAr
AV4TAr / gist:1350193
Created November 9, 2011 02:57
throw 404 exception in zend framework
<?php
throw new Zend_Controller_Action_Exception("UPS!!! This page don't exist",404);
@AV4TAr
AV4TAr / sphinx.conf
Created February 6, 2012 19:04
Mysql Meetup - Sphinx - ejemplo1
source source1
{
type = mysql
sql_host = mysqlA
sql_user = user
...
sql_query = SELECT id, group_id, UNIX_TIMESTAMP(date_added) \
date_added, title, content \
FROM documents
sql_attr_uint = group_id
@AV4TAr
AV4TAr / gist:1754328
Created February 6, 2012 19:41
Mysql Meetup - Sphinx ejemplo2
index test1 {
source = source1
source = source2
charset_type = sbcs
path = /sphinx/data/test1
}
@AV4TAr
AV4TAr / gist:1760825
Created February 7, 2012 17:23
Mysql Meetup - Sphinx ejemplo distrbuido
index dist1
{
type = distributed
local = archive
agent: hCHUNCK01:9332:CHUNK01
agent: hCHUNCK02:9332:CHUNK02
agent: hCHUNCK03:9332:CHUNK03
agent: hCHUNCK04:9332:CHUNK04
agent: hCHUNCK02:9332:CHUNK05
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"