Skip to content

Instantly share code, notes, and snippets.

foreach($states as $_state){
$rv['stateid-'.$_state->getId()] = $_state->getName();
foreach($_state->getAreas() as $_area){
$rv['areaid-'.$_area->getId()] = '-- ' . $_area->getName();
foreach ($_area->getCinemas() as $_cinema) {
$rv['cinemaid-'.$_cinema->getId()] = '---- ' . $_cinema->getName();
}
}
}
}
mysqldump --skip-triggers --compact --no-create-info
'AR' => array(
'CABA' => 'Ciudad de Buenos Aires',
'Provincia de Buenos Aires' => 'Provincia de Buenos Aires',
'Entre Rios' => 'Entre Ríos',
'Santa Fe' => 'Santa Fé',
'Misiones' => 'Misiones',
'Corrientes' => 'Corrientes',
'Chaco' => 'Chaco',
'Santiago del Estero' => 'Santiago del Estero',
'Cordoba' => 'Córdoba',
@guidokritz
guidokritz / fichero.rb
Created March 28, 2013 06:04
Chmod all files/directories recursively
find /path/to/base/dir -type d -print0 | xargs -0 chmod 755
find /path/to/base/dir -type f -print0 | xargs -0 chmod 644
@guidokritz
guidokritz / gist:5054354
Created February 28, 2013 05:11
Fix broken utf8 / latin characters
alter table descriptions modify name VARCHAR(2000) character set latin1;
alter table descriptions modify name blob;
alter table descriptions modify name VARCHAR(2000) character set utf8;
@guidokritz
guidokritz / to-csv.php
Created February 19, 2013 20:46
Export array to CSV
// Write CSV temporary file.
$temp = tmpfile();
foreach ( $lines as $line ) {
fputcsv( $temp, $line );
}
// Read temporary file and store contents into a variable.
fseek( $temp, 0 );
$contents = '';
while ( !feof( $temp ) ) {