Skip to content

Instantly share code, notes, and snippets.

View zburgermeiszter's full-sized avatar
👨‍💻
Available for Remote DevOps Engineer positions

Zoltan Burgermeiszter zburgermeiszter

👨‍💻
Available for Remote DevOps Engineer positions
View GitHub Profile
<?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
@zburgermeiszter
zburgermeiszter / apache directory recursive wget.txt
Created September 12, 2014 19:55
apache directory recursive wget
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.
@zburgermeiszter
zburgermeiszter / Rebuild single Doctrine entity.txt
Last active August 29, 2015 14:06
Rebuild single Doctrine entity
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
@zburgermeiszter
zburgermeiszter / Rebuild all doctrine entities
Created September 25, 2014 14:09
Rebuild all doctrine entities
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
@zburgermeiszter
zburgermeiszter / get_controller_routes.php
Last active August 29, 2015 14:07
List all routes implemented by current controller
<?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
@zburgermeiszter
zburgermeiszter / api_controller_route_listing_core.php
Last active August 29, 2015 14:07
API core controller with route listing
<?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;
@zburgermeiszter
zburgermeiszter / synchronous_ajax.js
Created October 9, 2014 10:41
Synchronous AJAX
function synchronousAJAX(param) {
var result = false;
$.ajax({
url: myURL + '/' + param,
dataType: "json",
async: false,
success: function() {
result = true;
},
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
@zburgermeiszter
zburgermeiszter / function.lazy.loader.php
Created October 24, 2014 10:36
Function lazy-loading
<?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";
@zburgermeiszter
zburgermeiszter / this.in.closure.php
Last active August 29, 2015 14:08
Access $this from Closure
<?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());