Skip to content

Instantly share code, notes, and snippets.

Markus Poerschke markuspoerschke

Block or report user

Report or block markuspoerschke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@markuspoerschke
markuspoerschke / file.php
Created Apr 4, 2019
Get SQL query as string from Extbase Query
View file.php
<?php
// ...
$queryParser = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($queryParser->convertQueryToDoctrineQueryBuilder($query)->getSQL());
View clear_gitlab_runner_cache.sh
docker ps -f status=exited | grep "\-cache-" | awk '{print $1}' | xargs docker rm
@markuspoerschke
markuspoerschke / get_jira_tasks_from_commits.sh
Last active Nov 29, 2017
Get Jira task-keys from commit messages.
View get_jira_tasks_from_commits.sh
# 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
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: http://www.example.com/var/www/news/mein-artikel
config.absRefPrefix = /
@markuspoerschke
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
\newenvironment{glossarydescription}{
\begin{list}{}{
\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
}
}
{\end{list}}
@markuspoerschke
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
<?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
markuspoerschke / router.php
Created Oct 7, 2012
Simple router.php for using the PHP 5.4 built-in webserver
View router.php
<?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
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
markuspoerschke / InvoiceAdmin.php
Created Sep 5, 2012
Translate value in SonataAdminBundle list
View InvoiceAdmin.php
class InvoiceAdmin extends Admin
{
// ...
protected function configureListFields(ListMapper $list)
{
$list
->addIdentifier('name')
// Use "trans" type to translate the given value
You can’t perform that action at this time.