Skip to content

Instantly share code, notes, and snippets.

View peschmae's full-sized avatar
🐢

Mathias Petermann peschmae

🐢
View GitHub Profile
@peschmae
peschmae / yaml-nest.go
Last active March 11, 2024 21:09 — forked from jghiloni/yaml-nest.go
Convert a string with property names that have dots in them to a nested structure
package main
import (
"log"
"os"
"strings"
"gopkg.in/yaml.v2"
)
@peschmae
peschmae / TransactionRepository.php
Created November 29, 2012 10:08
queryinterface
/**
* Finds incompleted transactions for a user. Used to have only one single
* transaction.
*
* @param $customerId
* @internal param string $customerNumber
* @return Tx_Extbase_Persistence_QueryResultInterface
*/
public function findIncompleteByCustomerId($customerId) {
$query = $this->createQuery();
@peschmae
peschmae / gist:3781226
Created September 25, 2012 11:27
inline printf ViewHelper
<f:format.printf arguments="{number: '{singleDigitToDisplayWithLeadingZero}'}">%1$02d</f:format.printf>
How can that be written inline?
Possible Workaround (Ugly, since we need to set the format in the controller)
Controller:
<?php
$this->view->assign('monthFormat', '%1$02d');
?>
View:
{monthFormat-> f:format.printf(arguments: {1:'{singleDigitToDisplayWithLeadingZero}'})}
@peschmae
peschmae / right way
Created August 8, 2014 17:33
Charset Conversion
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARCHAR(255) CHARACTER SET latin1;
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARBINARY(255);
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARCHAR(255) CHARACTER SET utf8;
<?php
/**
* Loads a user session
* @param string $sessionId
*
* @return boolean
*/
public function loadUserSession($sessionId) {
$this->feUserAuth->id = $sessionId;
$this->feUserAuth->fetchSessionData();