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 | |
// The header line informs the server of what to send the output | |
// as. In this case, the server will see the output as a .png | |
// image and send it as such | |
header ("Content-type: image/png"); | |
// Defining the background image. Optionally, a .jpg image could | |
// could be used using imagecreatefromjpeg, but I personally |
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
To apache directory listings recursively, use wget like below: | |
$ wget -r -np -nH -R index.html http://filestodownload/ | |
where -r is for recursive retrieving, -np is for no-parent option where wget won't get the parent directory when retrieving recursively, -nH equals to no host diretories where generation of host-prefixed directories will be disabled and -R is to omit index.html. |
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
Fixed: | |
php app/console doctrine:mapping:import VendorDatabaseBundle yml --filter="Entityname" | |
php app/console doctrine:mapping:convert annotation ./src --namespace="Vendor\DatabaseBundle\Entity\\" --from-database --force --filter="Entityname" | |
php app/console doctrine:generate:entities VendorDatabaseBundle:Entityname | |
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
To rebuild entity "configs" | |
php app/console doctrine:mapping:import --force AcmeBlogBundle yml | |
To convert them to PHP annotation format: | |
php app/console doctrine:mapping:convert annotation ./src | |
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 route names and details provided by the controller. | |
* Source: http://stackoverflow.com/questions/15943780/symfony2-get-list-of-all-routes-of-a-controller/15950365#15950365 | |
* @return null | |
*/ | |
protected function getControllerRoutes() { | |
/** | |
* @var $router \Symfony\Component\Routing\Router |
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 InstantWater\AdminApiBundle\Controller; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
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
function synchronousAJAX(param) { | |
var result = false; | |
$.ajax({ | |
url: myURL + '/' + param, | |
dataType: "json", | |
async: false, | |
success: function() { | |
result = true; | |
}, |
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
PlantUML: https://plugins.jetbrains.com/plugin/7017?pr=webStorm | |
After installing you can find it in View > Tool windows > PlantUML | |
Syntax manual: http://plantuml.sourceforge.net/classes.html |
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 | |
/** | |
Function lazy-loading with anonymous functions (closures) | |
Benefit: we can evaluate each test on demand instead of evaluating all, and find the failed. | |
*/ | |
// Test case selector | |
$testCase = "closure"; | |
//$testCase = "direct-call"; |
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 | |
/** | |
* In PHP 5.3 you can't access $this from anonymous functions, even if you inject $this to them, you still can't access private functions. | |
* Here's the workaround. With this you can inject $this to anonymous function and after calling publishPrivate() | |
* You'll be able to call private member functions when you need. | |
* All of them would't be needed in PHP 5.4 (but fortunately compatible with php 5.4 :) | |
*/ | |
var_dump(phpversion()); |
OlderNewer