Skip to content

Instantly share code, notes, and snippets.


Christopher Valles christophervalles

View GitHub Profile
christophervalles / fix_i18n_strings_from_po_file.php
Created May 2, 2012
Update i18n strings on the source code based on the changes made on a *.po file (Fix wrong sentences, change text, typos, etc). If you developed an app and some sentences on the base language are wrong or must be changed/fixed just create a .po file with
View fix_i18n_strings_from_po_file.php
ini_set('auto_detect_line_endings', TRUE);
$fin = fopen('en.po', 'r');
$change = 0;
$line = trim(fgets($fin));
christophervalles / script.php
Created Mar 23, 2012
Get the route name (if exists) that matches the given url in Zend Framework
View script.php
$referrer = $this->getRequest()->getServer('HTTP_REFERER');
$request = new Zend_Controller_Request_Http($referrer);
$router = clone $this->getFrontController()->getRouter();
$routeName = $router->getCurrentRouteName();
View power-set.php
function pc_array_power_set($array, $limit){
$subset = array();
$results = array(array());
foreach ($array as $element){
foreach ($results as $combination){
$result = array_merge(array($element), $combination);
array_push($results, $result);