Skip to content

Instantly share code, notes, and snippets.

View speedygfw's full-sized avatar

Frank Wallenborn speedygfw

View GitHub Profile
@speedygfw
speedygfw / gist:3225082
Created August 1, 2012 08:41
Validate multiple Models in Yii (generic)
<?php
/**
* validateModels
* @param array $models
* @return boolean $valid
*/
function validateModels(array $models)
{
$valid = true;
@speedygfw
speedygfw / fabfile.py
Created August 27, 2012 16:20
Zend2 - Module Generator - Fabfile
from fabric.api import local
def create_module(name):
local('mkdir %s' % name)
local('mkdir %s' % name + '/config')
#src
local('mkdir %s' % name + '/src')
local('mkdir %s' % name + '/src/%s' % name)
local('mkdir %s' % name + '/src/%s' % name + '/Controller')
@speedygfw
speedygfw / gist:3500595
Last active October 9, 2015 11:48
example of ZfcUser ControllerPlugin
<?php
//module.php
public function getControllerPluginConfig()
{
return array(
'invokables' => array(
'zfcUserAuthentication' => 'ZfcUser\Controller\Plugin\ZfcUserAuthentication'
)
@speedygfw
speedygfw / gist:7153586
Created October 25, 2013 12:01
Unterschiede zwischen isset und array_key_exists
<?php
$a = array('key1' => 'gesetzt', 'key2' => null);
isset($a['key1']); // true
array_key_exists('key1', $a); // true
isset($a['key2']); // false
array_key_exists('key2', $a); // true
@speedygfw
speedygfw / gist:7153700
Created October 25, 2013 12:12
Wetterdaten mit PHP und XPATH parsen
<?php
$xml = simplexml_load_file("http://weather.yahooapis.com/forecastrss?w=20067098&u=c");
$data = $xml->channel->item->xpath('yweather:condition');
$weatherToday = $data[0]->attributes();
var_dump($weatherToday);
@speedygfw
speedygfw / gist:7430327
Created November 12, 2013 12:54
SQL-Date(m/d/Y) to Euro-Date (d.m.Y)
SELECT DATE_FORMAT(my_date_field, GET_FORMAT(DATE,'EUR'));
@speedygfw
speedygfw / myproxy
Last active August 29, 2015 13:57
My simple NodeJS proxy
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy();
var options = {
'pad.fwallenborn.de': 'http://localhost:9001',
'spielfeld24.de': 'http://localhost::8000'
}
@speedygfw
speedygfw / gist:2cd5bdf932a70d5307db
Created June 26, 2014 06:21
ZF1 - http client with basic auth
<?php
$client = new Zend_Http_Client();
$client->setUri('http://example.com/');
$client->setAuth($user, $password);
$request = $client->request(Zend_Http_Client::POST);
@speedygfw
speedygfw / gist:3564d88aab719a962dd5
Created June 26, 2014 06:31
ZF2 -basic auth client
<?php
$client = new \Zend\Http\Client();
$client->setUri('http://example.com/');
$client->setAuth($user, $password);
$request = $client->request(Zend\Http\Client::POST);
Im /azure/tpl/widget/promoslider.tpl
[{if $sBannerLink }]
<a href="[{ $sBannerLink }]">
[{/if}]
durch
[{if $sBannerLink }]