Skip to content

Instantly share code, notes, and snippets.

View guiguiboy's full-sized avatar

guiguiboy

View GitHub Profile
#!/bin/bash
echo "Enable/Disable phpmyadmin on the server"
if [ "$#" -ne 1 ];then
echo "Usage pma.sh [up|down]"
exit 0
fi
if [ "$1" = "up" ];then
@guiguiboy
guiguiboy / gist:7113892
Last active December 26, 2015 07:19
firePHP example
<?php
$f = require_once('/var/www/myproject/vendors/FirePHPCore-0.3.2/lib/FirePHPCore/FirePHP.class.php');
$f = FirePHP::getInstance(true);
$f->fb('Hello FirePHP console', FirePHP::INFO);
?>
@guiguiboy
guiguiboy / gist:0b390a61bc79e842706d
Created October 2, 2014 10:20
behat - rich text
<?php
class MyContext extends \Behat\Behat\Context\BehatContext{
......
/**
* Allows to fill in a tinyMCE rich text textarea by disabling the control
*
* @Given /^I fill in rich text editor "([^"]*)" with "([^"]*)"$/
@guiguiboy
guiguiboy / command.php
Last active June 25, 2017 12:59
Symfony command to quickly compare structure between DB and entities
<?php
namespace AppBundle\Command;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@guiguiboy
guiguiboy / strict_type_add.sh
Created June 3, 2018 12:11
Adding declare strict_types=1 at the beginning of your PHP files
#!/bin/bash
add()
{
sed -i '1 s/<?php/<?php\
declare(strict_types=1);/g' $1
}
@guiguiboy
guiguiboy / phpstorm php config ubuntu debugger
Created June 24, 2018 21:08
Configuring PHPSTORM debugger with ubuntu for CLI debugging
config xdebug PHP
------------------------
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_port="9000"
xdebug.idekey="PHPSTORM"
xdebug.remote_log=/tmp/xdebug.log
@guiguiboy
guiguiboy / MainController.php
Last active April 4, 2023 12:36
Export large files using Symfony StreamedResponse and prevent memory limit issues
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class ExportController extends AbstractController
{
/**
* @Route("/export",name="export_route")