Skip to content

Instantly share code, notes, and snippets.

View renepardon's full-sized avatar

Christoph, René Pardon renepardon

View GitHub Profile
$(this).each(function() {
f_el.first().after(
$('<label/>').addClass(_invalidFlag)
.attr('for', f_el.attr('id'))
.text($(this)[0].message)
);
});
@renepardon
renepardon / gist:1268040
Created October 6, 2011 17:31
to much magic?
<?php
public function __call($name, $arguments)
{
if (preg_match('#^findBy(.*)#', $name, $matches)) {
$colName = strtolower($this->_filter->filter($matches[1]));
return $this->_returnCollection(
$this->_table->fetchAll(array($colName . '=?' => $arguments[0]))
);
} else {
@renepardon
renepardon / Manager.php
Created October 6, 2011 18:01
Entity Manager for Zend_Db_Table objects
<?php
/**
* YelaCMS
*
* LICENSE
*
* This file is part of YelaCMS.
*
* YelaCMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@renepardon
renepardon / gist:1354443
Created November 10, 2011 08:43
Throttling bandwidth with IP firewall on MacOSX
# Configure throttling on port 8080 and set maximum bandwidth to 56KByte/s
$ sudo ipfw pipe 1 config bw 56KByte/s
$ sudo ipfw add 1 pipe 1 src-port 8080
# Reset pipe 1:
$ sudo ipfw delete 1
@renepardon
renepardon / rename.sh
Created November 17, 2011 20:04
Rename images so that they can be used in iPhone4 (Retina)
#!/bash/sh
find . -name "*.png"
while read file;
do
mv "$file" ${file%.*}"@2x.png"
done
<?php
public function isValid($values)
{
if (array_key_exists('already_customer', $values)
&& $values['already_customer'] == 'on') {
$this->getElement('billingfirstname')->setRequired(false);
$this->getElement('billinglastname')->setRequired(false);
// ...
}
}
@renepardon
renepardon / config.ts
Created March 11, 2012 18:30
fluid typoscript example for fluid layout integration
page.10 = FLUIDTEMPLATE
page.10 {
partialRootPath = fileadmin/templates/partials/
layoutRootPath = fileadmin/templates/layouts/
variables {
siteInfoColumn < styles.content.get
siteInfoColumn.select.where = colPos=1
content < styles.content.get
@renepardon
renepardon / socketserver.php
Created March 31, 2012 20:47
Socket Server - part
<?php
$this->_clients[$i]['id'] = $i;
@renepardon
renepardon / jquery.queue.js
Created April 30, 2012 16:43
For those who need a queue for different reasons ;)
// Initializations.
var theQueue = $({});
var elements = [1, 2, 3, 4, 5, 6];
// Loop through all elements and add a function to the stack for every element.
$.each(elements, function(index, item)
{
theQueue.queue('stack', function(next)
{
// Do some processing here..
@renepardon
renepardon / gist:2571835
Created May 1, 2012 22:08
Where is the difference between anonymous function and private function?
function Konstruktor()
{
var privat = 'blubb';
function privateMethode()
{
alert (privat);
}
var anonymeMethode = function()
{