Skip to content

Instantly share code, notes, and snippets.

@makasim
makasim / gist:3209586
Created July 30, 2012 19:53
[FpOpenIdBundle][Failure Interactive]

Interactive User Creation

In the section Configure User Manager\Provider it was described how to create user on the fly(in the code). Sometime it is not enough information to do so. Maybe you want for some extra information like the user email, first\last name and so. This section describe how you can create user interactively.

Warning:

To proceed with this section you have to complete Steps 1,2 from Configure User Manager\Provider.

@makasim
makasim / gist:3720535
Last active June 26, 2017 06:32
form partial bind
<?php
namespace Foo\CoreBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormInterface;
/**
* Changes Form->bind() behavior so that it treats not set values as if they
@makasim
makasim / gist:3743251
Created September 18, 2012 13:55
temp file
<?php
namespace Makasim\File;
/**
* @author Kotlyar Maksim <[email protected]>
* @since 8/15/12
*/
class TempFile extends \SplFileInfo
{
/**
@makasim
makasim / gist:3810381
Created October 1, 2012 08:46
stub helper using trait
<?php
namespace Rj\CoreBundle\Test\Phpunit\Helper;
/**
* Usage:
*
* ```php
* <?php
* $fooStub = $this->getStub('FooClass', array(
* 'barMethod' => $stub
@makasim
makasim / skype-notify.py
Created October 25, 2012 10:21 — forked from nzjrs/skype-notify.py
Python script to make Skype co-operate with GNOME3 notifications
#!/usr/bin/env python
# Python script to make Skype co-operate with GNOME3 notifications.
#
#
# Copyright (c) 2011, John Stowers
#
# Adapted from skype-notify.py
# Copyright (c) 2009, Lightbreeze
#
#
@makasim
makasim / gist:4150016
Created November 26, 2012 19:15
InputRequiredInteractiveRequest
<?php
namespace Payum\Request;
use Payum\Request\InteractiveRequest;
class InputRequiredInteractiveRequest extends InteractiveRequest
{
public function getSubmitUrl();
public function getFields();
<?php
$crawler = new \Symfony\Component\DomCrawler\Crawler;
$crawler->addContent(file_get_contents(
'http://www.scorespro.com/soccer/uefa/uefa-cup/2012-2013/first-qualifying-round/'
));
/** @var $node \DOMElement */
foreach ($crawler->filter('table.gteam tr') as $node) {
}
@makasim
makasim / paypal.md
Last active December 12, 2015 09:39

Configure paypal express checkout payment

Step 1. Download paypal payum lib

Add the following lines in your composer.json file:

{
    "require": {
        "payum/paypal-express-checkout-nvp": "dev-master"
<?php
$internal = new \ArrayObject();
$internal['foo'] = 'foo';
$external = new ArrayObject($internal);
$external['foo'] = 'bar';
var_dump($internal['foo'], $external['foo']);
<?php
$input = new \ArrayObject;
$input['whatever'] = 'foo';
$array = new \ArrayObject($input);
var_dump($array['whatever']);
// will it return foo? right!
//but what about your custom ArrayObject?
class YourCustomArrayObject implements \ArrayAccess, \IteratorAggregate