Skip to content

Instantly share code, notes, and snippets.

@dominikzogg
dominikzogg / gist:2135954
Created March 20, 2012 14:04
sonata admin daterange
->add('orderdatefrom', 'doctrine_orm_callback',
array
(
'callback' => function(\Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery $queryBuilder, $alias, $field, $options)
{
if(!isset($options['value']) || !$options['value'])
{
return;
}
$value = $options['value'];
@dominikzogg
dominikzogg / runtime-conf.xml
Created March 17, 2012 21:45
PropelException: No connection information in your runtime configuration file for datasource ...
<?xml version="1.0" encoding="UTF-8"?>
<config>
<propel>
<datasources default="silextest">
<datasource id="silextest">
<adapter>mysql</adapter> <!-- sqlite, mysql, mssql, oracle, or pgsql -->
<connection>
<dsn>mysql:host=localhost;dbname=silextest</dsn>
<user>root</user>
<password>root</password>
@dominikzogg
dominikzogg / php-utf-8-function.php
Created January 8, 2012 14:32
php utf-8 encoding function
<?php
function encode_to_utf8 ($input) {
$output = $input;
if($encoding == get_encoding($input)) {
$output = iconv($encoding, "UTF-8", $output);
}
return($output);
}
@dominikzogg
dominikzogg / pdo-prep-stat-examples.php
Created January 8, 2012 14:29
PDO prepared statement examples
<?php
/* MYSQL Verbindungsdaten */
$mysql_connection['host'] = "";
$mysql_connection['username'] = "";
$mysql_connection['password'] = "";
$mysql_connection['database'] = "";
/* POSTGRESQL Verbindungsdaten */
$pgsql_connection['host'] = "";
@dominikzogg
dominikzogg / very-simple-encodingtester.php
Created January 8, 2012 14:27
very simple mysql encoding tester written in php
<?php
//header('content-type: text/html; charset=latin1');
header('content-type: text/html; charset=utf8');
$connection['host'] = "localhost";
$connection['username'] = "";
$connection['password'] = "";
$connection['database'] = "";
@dominikzogg
dominikzogg / ics.class.php
Created January 8, 2012 14:25
Ics class for php
<?php
/**
*
* Distributed under the GNU Lesser General Public License (LGPL v3)
* (http://www.gnu.org/licenses/lgpl.html)
* This program is distributed in the hope that it will be useful -
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
@dominikzogg
dominikzogg / xls.class.php
Created January 8, 2012 14:22
Pseudo xls class for php
<?php
/**
* xls.class.php
*
* Distributed under the GNU Lesser General Public License (LGPL v3)
* (http://www.gnu.org/licenses/lgpl.html)
* This program is distributed in the hope that it will be useful -
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@dominikzogg
dominikzogg / ftp.class.php
Created January 8, 2012 14:07
ftp.class.php
<?php
/**
* ftp.class.php
*
* Distributed under the GNU Lesser General Public License (LGPL v3)
* (http://www.gnu.org/licenses/lgpl.html)
* This program is distributed in the hope that it will be useful -
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@dominikzogg
dominikzogg / contao-googleanalytics-window-load.html
Created January 8, 2012 14:04
Load Contao Googleanalytics tracking after window load
<!-- indexer::stop -->
<!-- Google Analytics -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.addEvent('load', function()
{
var gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.');
Asset.javascript(gaJsHost + 'google-analytics.com/ga.js',
{
onload: function()
@dominikzogg
dominikzogg / contao-piwik-window-load.html
Created January 8, 2012 14:02
Load Contao Piwik tracking after window load
<!-- indexer::stop -->
<!-- Piwik -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.addEvent('load', function()
{
var pkBaseURL = 'https:' == document.location.protocol ? 'https://www.<domain>.<tld>/' : 'http://www.<domain>.<tld>/';
Asset.javascript(pkBaseURL + 'piwik.js',
{
onLoad: function(){