Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
heiglandreas / UUID1.php
Last active September 5, 2017 19:31
Different ways of a UUID-implementation
<?php
namespace Acme;
class UUID1
{
private $uuid;
public static function v4() { return new self(\UUID::v4())
private function __construct(\UUID $uuid) { $this->uuid = $uuid; }
@heiglandreas
heiglandreas / Ldap.php
Last active June 30, 2017 06:59
Use Zend-Ldap as authentication backend when you want to authenticate using different attributes
<?php
namespace Acme\Authentication\Adapter;
use Zend\Authentication\Adapter\Ldap as LdapAdapter;
class Ldap extends LdapAdpater
{
public function authenticate()
{
@heiglandreas
heiglandreas / ldap.php
Last active November 11, 2021 20:02
Disable Certificate-check for LDAPS/ldap_tls
<?php
$con = ldap_connect('ldaps://ldap.example.com');
ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($con, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
/*
Possible values:
LDAP_OPT_X_TLS_NEVER
This is the default. slapd will not ask the client for a certificate.
@heiglandreas
heiglandreas / Result.txt
Created November 30, 2016 18:27
Compare Iconv and Intl for Transliteration
Heiz��lr��cksto��d��mpfer
Heizoelrueckstossdaempfer
$('#comment').unbind('keyup');
$("#comment").keyup(function(e) {
var offset = this.offsetHeight - this.clientHeight;
$(this).css('height', this.scrollHeight + offset);
});
@heiglandreas
heiglandreas / CommandInterface.php
Created July 9, 2016 20:57
First ideas for interfaces for console-commands
<?php
interface CommandInterface
{
public function execute(InputInterface $input, OutputInterface $output);
}

You've got strange characters like "�" or "ö" display in your application? Yes, handling non-English characters in application code, files and databases can be a challenge, to say the least. Whether that's German Umlauts, Cyrillic letters, Asian Glyphs or Emojis: It's always a mess in an international application. In this session you will see why that is and how handling characters evolved in computing. You will also see how handling characters in applications and databases can be done less painfully. And don't worry when EBCDIC, BOM or ISO-8859-7 are Greek to you and your Unicode is a bit rusty: we'll have a look at them too!

# Get the current GIT-Branch-name in brackets
function parse_git_branch_and_add_brackets {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
# Set the current IP-Address to the variable IP
IP=$(route -n get default|grep interface|cut -b 14- | xargs ipconfig getifaddr);
#
# Set the Prompt to the following:
# username@ip-address currentDirectory gitBranchIfExists
export PS1="\u@\[\033[1;31m\]$IP\[\033[0m\] \W\[\033[33m\]\$(parse_git_branch_and_add_brackets)\[\033[0m\] \$ "
@heiglandreas
heiglandreas / expectedResult
Created May 23, 2016 05:30
DST-Issues in PHPs Date-Component
2016-10-30T01:30:00+02:00
2016-10-30T02:30:00+02:00
2016-10-30T02:30:00+01:00
2016-10-30T03:30:00+01:00
@heiglandreas
heiglandreas / README.md
Created May 10, 2016 11:09
How to install a dependency that depends on a dev-dependency

The issue:

Given a project that has the minimum-stability set to "stable" and a dependency of the project - itselv being stable - has a dependency to a dev-version of a lib.

How can one use composer require to install that lib without having to prepare the composer.json before by adding the dependencies dependency as @dev as described here.

As an example you can use the given composer.json and shell-command to test that issue. But it does not seem to be limited to that case.