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 | |
// Get array of months - useful for month dropdown for example | |
function getmonths() { | |
$months = array(); | |
for ($m=1; $m<=12; $m++) { | |
$months[] = date('m', mktime(0,0,0,$m,1)); | |
} | |
return $months; |
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 | |
# Usage: ./update_phpstorm.sh http://download.jetbrains.com/webide/PhpStorm-EAP-126.36.tar.gz | |
echo "Downloading $1..." | |
sudo wget $1 -O phpstorm_eap.tar.gz | |
echo "Moving download..." | |
sudo mv phpstorm_eap.tar.gz /usr/local/bin/phpstorm_eap.tar.gz |
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 | |
/** | |
* @return null|\DateTime | |
*/ | |
public function findLastModifiedThing() | |
{ | |
$query = $this->createQueryBuilder('t') | |
->select('t.updated_at') | |
->orderBy('t.updated_at', 'desc') |
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 | |
namespace Acme\DemoBundle\Listener; | |
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; | |
use Acme\DemoBundle\Controller\Cacheable; | |
class CacheControllerListener | |
{ | |
/** |
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 | |
namespace Acme\DemoBundle\Controller; | |
/** | |
* Any controller that implements this interface will be eligible for caching. This works by an event | |
* listener that will look to see if the controller implements this interface and if it does, will call its | |
* getLastModifiedDate() method to check if the content has been modified or not. If not, | |
* then it will tell the controller to simply return the 304 response. | |
* | |
*/ |
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 | |
namespace Acme\DemoBundle\Controller; | |
use Symfony\Component\HttpFoundation\Response; | |
use FOS\RestBundle\Controller\FOSRestController; | |
use FOS\RestBundle\View\View; | |
use Doctrine\ORM\EntityRepository; | |
abstract class RestController extends FOSRestController | |
{ |
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 | |
/** | |
* Find the last modified date | |
* | |
* @return \DateTime | |
*/ | |
public function getLastModifiedDate() | |
{ | |
$modifiedDate = $this->thingRepository->findLastModifiedThing(); |
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 | |
namespace Acme\Bundle\DoctrineExtensions\DBAL\Types; | |
use Doctrine\DBAL\Platforms\SQLServerPlatform; | |
use Doctrine\DBAL\Types\DateTimeType as BaseDateTimeType; | |
use Doctrine\DBAL\Platforms\AbstractPlatform; | |
use Doctrine\DBAL\Types\ConversionException; | |
class DateTimeType extends BaseDateTimeType |
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
{ | |
name: "acme", | |
version: "1.0.0", | |
description: "ACME demo application", | |
license: "MIT", | |
private: true, | |
ignore: [ | |
"**/.*", | |
"node_modules", | |
"bower_components", |
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
... | |
{% block javascripts%} | |
{% javascripts | |
'@AcmeDemoBundle/Resources/public/vendor/jquery/jquery.js' | |
'@AcmeDemoBundle/Resources/public/vendor/underscore/underscore.js' | |
%} | |
<script src="{{ asset_url }}"></script> | |
{% endjavascripts %} | |
{% endblock %} |
OlderNewer