Skip to content

Instantly share code, notes, and snippets.

Thijs Feryn ThijsFeryn

Block or report user

Report or block ThijsFeryn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ThijsFeryn
ThijsFeryn / Magento APC cache
Created Jun 22, 2012
Configuring Magento APC cache backend in local.xml
View Magento APC cache
<global>
...
<cache>
<backend>apc</backend>
<prefix>MAGE_</prefix>
</cache>
...
</global>
@ThijsFeryn
ThijsFeryn / Magento Memcached cache
Created Jun 22, 2012
Configuring Magento Memcached cache backend in local.xml
View Magento Memcached cache
<global>
...
<cache>
<backend>memcached</backend>
<memcached>
<servers>
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
View Magento APC settings
apc.max_file_size = 10M
apc.shm_size = 128M
@ThijsFeryn
ThijsFeryn / PHP command line arguments
Created Jun 26, 2012
Working with arguments in PHP on the command line
View PHP command line arguments
$ php cli.php arg1 arg2
@ThijsFeryn
ThijsFeryn / gist:2994304
Created Jun 26, 2012
Working with arguments in PHP on the command line
View gist:2994304
<?php
echo "There are {$argc} passed: ".PHP_EOL;
foreach($argv as $k=>$v){
echo "Argument {$k}: {$v}".PHP_EOL;
}
@ThijsFeryn
ThijsFeryn / gist:2994370
Created Jun 26, 2012
Working with I/O streams in PHP
View gist:2994370
$ php test.php < test.txt
@ThijsFeryn
ThijsFeryn / gist:2994393
Created Jun 26, 2012
Working with I/O streams in PHP
View gist:2994393
<?php
$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');
$stderr = fopen('php://stderr', 'w');
while(!feof($stdin)){
$line = trim(fgets($stdin));
if(strlen($line) > 0){
fwrite($stdout,strrev($line).PHP_EOL);
} else {
@ThijsFeryn
ThijsFeryn / gist:2994427
Created Jun 26, 2012
Short syntax for PHP command line I/O streams
View gist:2994427
<?php
while(!feof(STDIN)){
$line = trim(fgets(STDIN));
if(strlen($line) > 0){
fwrite(STDOUT,strrev($line).PHP_EOL);
} else {
fwrite(STDERR,"An empty line was passed".PHP_EOL);
}
}
@ThijsFeryn
ThijsFeryn / gist:3034005
Created Jul 2, 2012
Syntax highlighting using the PHP command line
View gist:3034005
$ php -s test.phps
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if(</span><span style="color: #0000BB">$_REQUEST</span><span style="color: #007700">[</span><span style="color: #DD0000">'a'</span><span style="color: #007700">]&nbsp;==&nbsp;</span><span style="color: #DD0000">'b'</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Some&nbsp;output'</span><span style="color: #007700">;<br />}<br /></span>
</span>
</code>
$
You can’t perform that action at this time.