This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeController extends Controller | |
{ | |
public function someAction() | |
{ | |
$dispatcher = $this->get('event_dispatcher'); | |
$dispatcher->addListener('kernel.response', function (\Symfony\Component\EventDispatcher\Event $event) { | |
file_put_contents( | |
'/tmp/memory_logger.txt', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP) | |
Author: _ck_, GK, stasilok | |
Version: 0.1.3 | |
Free for any kind of use or modification, I am not responsible for anything, please share your improvements | |
* revision history | |
0.1.3 2013-03-30 show host and php version, can bookmark with hashtag ie. #statistics - needs new layout asap | |
0.1.2 2013-03-25 show optimization levels, number formatting, support for start_time in 7.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\>slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX | |
C:\>slmgr.vbs -ato |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
PS1='${debian_chroot:+($debian_chroot)}[\[\033[00;31m\]\u@\h\[\033[00m\] \[\033[00;34m\]\w\[\033[00m\]\[\033[00;31m\]$(parse_git_branch)\[\033[00m\]]\n\$ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In config.yml: | |
services: | |
cache: | |
class: Doctrine\Common\Cache\ApcCache | |
In code: | |
if ($this->get('cache')->contains('menu')) { | |
$menu = unserialize($this->get('cache')->fetch('menu')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Remove bundle files | |
rm -rf src/Acme | |
sed -i '/AcmeDemoBundle/,+2 d' app/config/routing_dev.yml | |
sed -i '/AcmeDemoBundle/d' app/AppKernel.php | |
rm -rf web/bundles/acmedemo | |
# Remove the base template | |
rm -rf app/Resources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find symfony/ -name '*.php' -exec grep -iR '^class ' {} \; | cut -d' ' -f2 | awk '{ print length, $0 }' | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2 | |
tar xf wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2 | |
php -S localhost:9090 & | |
PHP_PID=$! | |
./wkhtmltopdf-amd64 --footer-right "[page]/[topage]" http://localhost:9090/ poc.pdf | |
kill $PHP_PID | |
rm wkhtmltopdf* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'app/Mage.php'; | |
Mage::app(); | |
$modules = Mage::getConfig()->getNode('modules')->children(); | |
foreach ($modules as $moduleName => $moduleSettings) { | |
echo '[' . ($moduleSettings->is('active') ? 'active' : 'disabled') . "]\t"; | |
echo $moduleName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Tips: | |
// prepend with xvfb-run to wrap call in virtual x-server (if wkhtmltopdf version is old and no X is found) | |
// -O landscape (to turn page 90 deg) | |
// --post requestType genpdf (to post params, is repeatable) | |
// --footer-right "[page]/[topage]" | |
// read man whktmltopdf | |
$command = '/usr/local/bin/wkhtmltopdf -q http://' . $_SERVER["SERVER_NAME"]; |