Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Valles christophervalles

View GitHub Profile
@christophervalles
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
<?php
system('clear');
ini_set('auto_detect_line_endings', TRUE);
$fin = fopen('en.po', 'r');
$change = 0;
while(!feof($fin)){
$line = trim(fgets($fin));
@christophervalles
christophervalles / script.php
Created Mar 23, 2012
Get the route name (if exists) that matches the given url in Zend Framework
View script.php
<?php
$referrer = $this->getRequest()->getServer('HTTP_REFERER');
$request = new Zend_Controller_Request_Http($referrer);
$router = clone $this->getFrontController()->getRouter();
$router->route($request);
$routeName = $router->getCurrentRouteName();
View power-set.php
<?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);
You can’t perform that action at this time.