Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
<title>Ein Kontaktformular</title>
<?php
echo "<b><br>Projekt: Hello World";
$Vorname="Florian";
$Nachname="Hrubicek";
echo "<b><br>Name: $Vorname $Nachname";
$Adresse="Holzing 6";
$PLZ="3300 Winklarn,";
<?php
class LoginForm extends Szene1_Html_Form
{
/**
* Schablonenmethode, wird von parent::__construct() aufgerufen
*/
public function init()
{
$this->setAction("/login");
@CHH
CHH / function_currying.php
Created December 6, 2010 12:10
Prefill the arguments of functions (Currying)
<?php
function func_curry($fn)
{
$args = array_slice(func_get_args(), 1);
return function() use ($fn, $args) {
$args = array_merge($args, func_get_args());
return call_user_func_array($fn, $args);
};
@CHH
CHH / function_wrapping.php
Created December 6, 2010 12:21
Wrap a function inside another function
<?php
function func_wrap($fn, $wrapper)
{
// Unify calling of the wrapped function
if(is_array($fn) or is_string($fn)) {
$original = function() use ($fn) {
return call_user_func_array($fn, func_get_args());
};
} else {
<?php
// pipes each function's return value as input into the next function in the chain
function func_compose()
{
$fns = func_get_args();
$composition = function() use ($fns) {
$input = func_get_args();
foreach ($fns as $fn) {
$return = call_user_func_array($fn, $input);
@CHH
CHH / .gitignore
Created August 2, 2011 21:09
PHP Templating Engine with bindable $this support in 53 LOC
vendor/
composer.lock
@CHH
CHH / MetaObject.php
Created August 30, 2011 13:55
PHP does Meta Programming too! (Requires PHP 5.4)
<?php
namespace CHH;
trait MetaObject
{
protected static $__metaClass;
static function setMetaClass(MetaClass $metaClass)
{
https://yoursvnserver.example.com/framework lib/framework
https://someotherlibrary.example.com/framework lib/other_framework
@CHH
CHH / browserid.php
Created September 28, 2011 11:39
PHP BrowserID verification function
<?php
/**
* Verifies the given BrowserID assertion
*
* @throws \UnexpectedValueException on error
*
* @param string $assertion Assertion provided by navigator.id.getVerifiedEmail()
* @param string $audience Host Name, defaults to $_SERVER['HTTP_HOST']
* @param string $verifyService URL of the verification webservice, defaults BrowserID's
@CHH
CHH / git-flow-feature-build
Created February 3, 2012 11:07
git-flow-feature-build
#!/usr/bin/env bash
# The most important line in every Shell Script.
set -e
JENKINS_USER="$(git config --get jenkins.username)"
JENKINS_PASSWORD="$(git config --get jenkins.password)"
if [ -n "$2" ]; then
JENKINS_JOB="$2"