Skip to content

Instantly share code, notes, and snippets.

View habibun's full-sized avatar

Habibun Noby habibun

  • Eon Infosys Technology
  • Dhaka, Bangladesh
View GitHub Profile
<?php
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
/**
* UserRepository
*
<?php
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
/**
* UserRepository
*
@habibun
habibun / ClassMetadataInfo.php
Created March 12, 2015 04:48
PHP 5.6.3 Doctrine Bug ->location:vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
public function newInstance()
{
if ($this->_prototype === null) {
if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513 || PHP_VERSION_ID >= 50600) {
$this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
}
}
@habibun
habibun / RegisterKernelListenersPass.php
Created March 31, 2015 03:39
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback -> location:vendor\symfony\src\Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass.php
$event['method'] = 'on'.preg_replace_callback(array(
'/(?<=\b)[a-z]/i',
'/[^a-z0-9]/i',
), function ($matches) { return strtoupper($matches[0]); }, $event['event']);
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
@habibun
habibun / RegisterKernelListenersPass.php
Created May 21, 2015 12:10
Deprecated: preg_replace(): The /e modifier is deprecated
$event['method'] = 'on'.preg_replace(array(
'/(?<=\b)[a-z]/ie',
'/[^a-z0-9]/i'
), array('strtoupper("\\0")', ''), $event['event']);
replace with
$event['method'] = 'on'.preg_replace_callback(array(
'/(?<=\b)[a-z]/i',
@habibun
habibun / 000-Projects.conf
Last active December 26, 2016 05:12
ubuntu symfony2 virtual host
<VirtualHost *:80>
ServerName craft.local
ServerAlias www.craft.local
DocumentRoot /home/jony/Projects/craft/web
<Directory /home/jony/Projects/craft/web>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order Allow,Deny
Allow from All
@habibun
habibun / error_reporting.txt
Last active November 25, 2015 16:12
php error reporting on manually in php script
error_reporting(-1);
ini_set('display_errors', 'On');
@habibun
habibun / ubuntu-php-development-environment.md
Created December 7, 2015 15:52 — forked from DaRaFF/ubuntu-php-development-environment.md
Ubuntu php development environment

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@habibun
habibun / scriptExecution.php
Created December 15, 2015 14:30
check script execution time
<?php
// Start timing
$startTime = microtime( true );
// Perform the operation
for ( $i=0; $i<10; $i++ ) {
echo "<p>Hello, world!</p>";
}
// Stop timing
$endTime = microtime( true );
$elapsedTime = $endTime - $startTime;