Skip to content

Instantly share code, notes, and snippets.


Markus Poerschke markuspoerschke

View GitHub Profile
View gist:350e3db6dfaa1a7aebfcab4c8a63df43
git branch | egrep -v "(^\*|master|dev)" | xargs git branch -d
markuspoerschke / file.php
Created Apr 4, 2019
Get SQL query as string from Extbase Query
View file.php
// ...
$queryParser = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
docker ps -f status=exited | grep "\-cache-" | awk '{print $1}' | xargs docker rm
markuspoerschke /
Last active Nov 29, 2017
Get Jira task-keys from commit messages.
# This will get all task keys that are relevant for the version 2.5.0 release
git log 2.4.0..2.5.0 --pretty=oneline | perl -ne '{ /(\w+)-(\d+)/ && print "$1-$2,"}'
markuspoerschke / page.ts
Last active Dec 19, 2015
TYPO3: Using typolink in scheduler
View page.ts
# In your TypoScript you should add the absolute prefix
# or URL would look like this:
config.absRefPrefix = /
markuspoerschke / customList.tex
Created Apr 25, 2013
Create a custom list for LaTeX. For my final paper for a degree as computer specialist I needed to add a glossary and a table of acronyms. I did not want to use a package. For this reason I looked for a simple solution: `\newenviroment` offers the possibility to define a custom list. Here is an Example on how to define a custom list.
View customList.tex
% Custom list for glossary
\setlength{\labelsep}{0mm} % space before text.
\setlength{\labelwidth}{44mm} % width of the label.
\setlength{\leftmargin}{44mm} % adjust margin. same size as labelwidth.
\renewcommand{\makelabel}[1]{\textbf{##1\space}\dotfill\space} % \dotfill creates a line of dots. you can also use \hfill
markuspoerschke / hashStringFunction.php
Created Jan 23, 2013
Simple hashing function in PHP. Any alogrithm supported by the build in hash() function can be used. This function actually only adds rounds and concatenate the string with a salt.
View hashStringFunction.php
* @param $string string The string/password to be hashed
* @param $salt string The salt that will be added to the string
* @param $rounds int Number of rounds
* @param $algo string The algorithm that should be used for hashing
* @return string Returns the hashed string
function createHash($string, $salt = '', $rounds = 500, $algo = 'sha256') {
markuspoerschke / router.php
Created Oct 7, 2012
Simple router.php for using the PHP 5.4 built-in webserver
View router.php
// Filename of requested file...
$requested = __DIR__ . $_SERVER['REQUEST_URI'];
// If file exists use file
if (file_exists($requested) && !is_dir($requested)) {
return false;
markuspoerschke / ModelAdmin.php
Created Sep 7, 2012
SonataAdminBundle: Validate Unique
View ModelAdmin.php
class ModelAdmin extend Admin
// ...
public function validate(ErrorElement $errorElement, $object)
// find object with the same uniqueField-value
$other = $this->modelManager->findOneBy($this->getClass(), array('uniqueField' => $object->getUniqueSlug()));
if (null !== $other && !$other->equals($object)) {
markuspoerschke / InvoiceAdmin.php
Created Sep 5, 2012
Translate value in SonataAdminBundle list
View InvoiceAdmin.php
class InvoiceAdmin extends Admin
// ...
protected function configureListFields(ListMapper $list)
// Use "trans" type to translate the given value