Skip to content

Instantly share code, notes, and snippets.

@frodosghost
frodosghost / prototype_extend.js
Created May 16, 2011 11:55
Extending Ajax Request object for aborting
/**
* Extend the Ajax.Request object to add function to abort() current Ajax Request
*
* @source http://blog.pothoven.net/2007/12/aborting-ajax-requests-for-prototypejs.html
*/
Object.extend(Ajax.Request.prototype, {
abort: function() {
// prevent and state change callbacks from being issued
this.transport.onreadystatechange = Prototype.emptyFunction;
// abort the XHR
@frodosghost
frodosghost / flash_message_usage.php
Created May 23, 2011 12:52 — forked from BaylorRae/flash_messages.php
Flash Messages for PHP
<?php
/**
* Usage Examples
*/
$flash_message = FlashMessage::getInstance();
$flash_message->set('notice', 'This is a notice message');
$flash_message->flash('This is a flash message');
?>
<?php if ($flash_message->has('notice')) : ?>
@frodosghost
frodosghost / phing_install_error
Created January 11, 2012 01:57
Phing Pear Package Install Error
WARNING: "pear/PEAR_PackageFileManager" is deprecated in favor of "pear/PEAR_PackageFileManager2"
Did not download optional dependencies: phing/phingdocs, pear/VersionControl_SVN, pear/VersionControl_Git, pear/PhpDocumentor, pecl/Xdebug, pear/PEAR_PackageFileManager, pear/Services_Amazon_S3, pear/HTTP_Request2, pdepend/PHP_Depend, phpmd/PHP_PMD, phpunit/phpcpd, docblox/DocBlox, pear/PHP_CodeSniffer, use --alldeps to download automatically
phing/phing can optionally use package "phing/phingdocs" (version >= 2.4.9)
phing/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.4.0)
phing/phing can optionally use package "pear/VersionControl_Git" (version >= 0.4.3)
phing/phing requires package "phpunit/PHPUnit" (version >= 3.6.0), installed version is 3.5.13
phing/phing requires package "phpunit/PHP_CodeCoverage" (version >= 1.1.0), installed version is 1.0.4
phing/phing can optionally use package "pear/PhpDocumentor" (version >= 1.4.0)
phing/phing can optionally use package "pecl/Xdebug" (versio
@frodosghost
frodosghost / BasePage.php
Created April 13, 2012 06:16
BasePage setup for Doctrine2 Table Inheritance. Shows Content from same bundle and FrontPage from a separate Bundle.
<?php
namespace Manhattan\Bundle\ContentBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Manhattan\Bundle\ContentBundle\Entity\BasePage
*
* @ORM\Table(name="base_page")
@frodosghost
frodosghost / EditFormSubscriberTest.php
Created May 9, 2012 11:25
Unit Testing Symfony2 Forms
<?php
namespace Manhattan\Bundle\GalleryBundle\Tests\Form;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Manhattan\Bundle\GalleryBundle\Form\EventListener\EditFormSubscriber;
class EditFormSubscriberTest extends \PHPUnit_Framework_TestCase
@frodosghost
frodosghost / CommentType.php
Last active December 11, 2015 20:19
Base form code for saving multiple classes of data with Symfony2. This is for Jerome.
<?php
namespace Your\Product\Bundle\Form\CommentType;
use Your\Product\Bundle\Form\UserType;
class CommentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
@frodosghost
frodosghost / ManyToEntityTransformer
Created April 12, 2014 21:58
Data Transformer: Many to Many for Entity Field
<?php
namespace Acme\DemoBundle\Form\DataTransformer;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\PersistentCollection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
@frodosghost
frodosghost / app.js
Created February 19, 2016 19:50
AngularJS and Twig Templates
var antelopeApp = angular.module('antelopeApp', [
'ngRoute',
'antelopeControllers'
]).config(function($interpolateProvider){
$interpolateProvider.startSymbol('{[{').endSymbol('}]}');
});
@frodosghost
frodosghost / ScriptHandler.php
Last active March 24, 2016 16:08
Dependency Inception: Installing Bower dependencies with Composer
<?php
namespace AppBundle\Composer;
use Composer\Script\Event;
use Symfony\Component\Process\Process;
/**
* Script for Running NPM as part of Composer Update
*
@frodosghost
frodosghost / ScriptHandler.php
Last active March 24, 2016 16:12
Dependency Inception: Composer, Installing NPM, Installing Bower
<?php
namespace AppBundle\Composer;
use Composer\Script\Event;
use Symfony\Component\Process\Process;
/**
* Script for Running NPM as part of Composer Update
*