services:
mycompany.demobundle.listener.request:
class: MyCompany\DemoBundle\RequestListener
arguments: [@router, @security.context]
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
This file contains hidden or 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 | |
namespace AppBundle\Twig; | |
use Exception; | |
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface; | |
class GulpRevVersionStrategy implements VersionStrategyInterface | |
{ | |
private $manifestFilename; |
This file contains hidden or 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 | |
namespace MyApp\ApiBundle\Listener; | |
use Symfony\Component\HttpKernel\Event\FilterResponseEvent; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\HttpKernel\HttpKernelInterface; | |
use Symfony\Component\HttpFoundation\Cookie; | |
use Doctrine\ORM\EntityManager; |
This file contains hidden or 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 the appropriate file from here | |
https://wkhtmltopdf.org/downloads.html#stable | |
```bash | |
sudo yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 | |
sudo yum install -y urw-fonts libXext libXrender fontconfig libfontconfig.so.1 | |
sudo cp wkhtmltox/bin/wkhtmltopdf /usr/bin/. | |
sudo chmod 755 /usr/bin/wkhtmltopdf |
This file contains hidden or 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
$monologHandler = new Monolog\Logger( | |
'Logger', | |
array( | |
new Monolog\Handler\StreamHandler('/tmp/log.txt', Monolog\Logger::DEBUG) | |
) | |
); | |
$stack = GuzzleHttp\HandlerStack::create(); | |
$stack->push( | |
GuzzleHttp\Middleware::log( |
This file contains hidden or 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
/* | |
* Outputs a float representing the iOS version if user is using an iOS browser i.e. iPhone, iPad | |
* Possible values include: | |
* 3 - v3.0 | |
* 4.0 - v4.0 | |
* 4.14 - v4.1.4 | |
* false - Not iOS | |
*/ | |
var iOS = parseFloat( |
This file contains hidden or 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
# On the local machine the command below creates a public key in .ssh/id_rsa.pub | |
ssh-keygen -t rsa | |
# Copy this to the remote server | |
scp .ssh/id_rsa.pub user@remote-ip:/home/tayhimself/. | |
# ssh in to the remote server and cd into the home dir | |
cat id_rsa.pub >> .ssh/authorized_keys | |
# OR | |
# do it in 1 step |
Use sudo or su or whatever to switch to root
If you want to install the remi repositories for PHP for example
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
Now in order to update use the remi as well as the default repos, first check what repos are installed, enable them and run update. Some examples below
This file contains hidden or 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
# Delete npm modules | |
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs sudo npm -g rm | |
# First: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
#go to /usr/local/lib and delete any node and node_modules |
This file contains hidden or 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
# CentOS 6.5 APC guide from http://www.tecmint.com/install-apc-alternative-php-cache-in-rhel-centos-fedora/ | |
# php v 5.3.3 | |
yum install php-pear php-devel httpd-devel pcre-devel gcc make | |
pecl install apc | |
# Add the extension to apc.ini | |
echo "extension=apc.so" > /etc/php.d/apc.ini |