Skip to content

Instantly share code, notes, and snippets.

Avatar

Toni Uebernickel havvg

View GitHub Profile
@havvg
havvg / ajax-form.js
Created Aug 1, 2012
jQuery AJAX form submit with Twitter Bootstrap modal
View ajax-form.js
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@havvg
havvg / Firewall.js
Last active Aug 4, 2022
ExtJS 6: JSON Web Token API Login with Promises
View Firewall.js
Ext.define('App.security.Firewall', {
singleton: true,
requires: [
'App.security.TokenStorage'
],
isLoggedIn: function() {
return null !== App.security.TokenStorage.retrieve();
},
@havvg
havvg / symfony.phpunit.xml
Created Dec 3, 2010
An example PHPUnit configuration file for symfony projects running on 512MB phpUnderControl server
View symfony.phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="true">
<filter>
<blacklist>
@havvg
havvg / Builder.php
Created Feb 8, 2012
Symfony2 KnpMenu TwitterBootstrap switch user menu
View Builder.php
<?php
namespace Ormigo\Bundle\BackofficeBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Ormigo\Bundle\UserBundle\Model\User\UserQuery;
use Symfony\Component\Security\Core\Role\SwitchUserRole;
@havvg
havvg / git-bisect-phpunit.sh
Created Dec 20, 2011
git bisect phpunit wrapper
View git-bisect-phpunit.sh
#!/bin/bash
phpunit
EXIT_CODE="$?"
if [ $EXIT_CODE -eq "255" ]; then
# Wrapping the error code to 1, so bisect marks this build as "bad" and continues.
exit 1
fi
@havvg
havvg / DateRange.php
Last active Oct 24, 2021
Symfony2: poor man's date_range form type
View DateRange.php
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Model;
use DateTime;
class DateRange
{
/**
* @var DateTime
@havvg
havvg / AsynchronousEventDispatcher.php
Last active Jan 20, 2021
Asynchronous Event Dispatcher
View AsynchronousEventDispatcher.php
<?php
namespace Ormigo\Component\EventDispatcher;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@havvg
havvg / schema.xml
Created Aug 13, 2012
Propel 1.6: Sluggable with I18n
View schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<database name="default" defaultIdMethod="native" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd">
<table name="country">
<column name="id" type="integer" autoIncrement="true" primaryKey="true" />
<column name="iso_code" type="char" size="2" required="true" />
<column name="name" type="varchar" size="255" required="true" primaryString="true" />
<behavior name="i18n">
<parameter name="i18n_columns" value="name, url" />
<parameter name="default_locale" value="de_DE" />
@havvg
havvg / ZendKernel.php
Created Dec 29, 2016
StackPHP Example: Symfony + Zend Framework (ZF1)
View ZendKernel.php
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
class ZendKernel implements HttpKernelInterface, TerminableInterface
View .gitconfig
[core]
editor = mate -w -l 1
excludesfile = ~/.gitignore
whitespace = trailing-space,space-before-tab,-indent-with-non-tab,tab-in-indent,tabwidth=2
autocrlf = input
ignorecase = true
[diff]
patience = true
algorithm = patience
[notes]