Skip to content

Instantly share code, notes, and snippets.

View Burgov's full-sized avatar

Bart van den Burg Burgov

View GitHub Profile
next a
start handling a
next b
next c
next d
finish handling a
(skip b, c)
start handling d
next e
next f
this.route.params.take(1).subscribe(params => {
this.initializer.initialize()
.subscribe(
() => { this.router.navigateByUrl(params['returnUrl'] || '/', {clearHistory: true}) },
() => { this.router.navigateByUrl(params['returnUrl'] || '/', {clearHistory: true}) }
);
});
var $newScope = $($event.target).scope().$new();
var $expand = $('<order-history-month></order-history-month>');
$compile($expand)($newScope);
ExpandPositioner.insertIntoPage($expand);
var $newScope = $($event.target).scope().$new();
var $expand = $('<order-history-month></order-history-month>');
$compile($expand)($newScope);
ExpandPositioner.insertIntoPage($expand);
@Burgov
Burgov / CSRFListener.php
Last active August 12, 2023 03:32
CSRF protection for AJAX requests
<?php
namespace myApp\APIBundle\Http;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@Burgov
Burgov / gist:5402594
Created April 17, 2013 08:09
angular forms
<!doctype html>
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js"></script>
<script>
angular.module('app', []);
angular.module('app').controller('test', function($scope) {
});
</script>
<datagrid>
<data>{{ printers|serialize|raw }}</data>
<columns>
<column name="id"></column>
<column name="name"></column>
<column name="port"></column>
<column name="ip">IP Address</column>
</columns>
<crud>
<datagrid>
<data>{{ printers|serialize|raw }}</data>
<columns>
<column name="id"></column>
<column name="name"></column>
<column name="port"></column>
<column name="ip">IP Address</column>
</columns>
<crud>
<?php
// namespace stuff...
class FriendSelectorType extends AbstractType
{
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setRequired(array('user'));
<?php
class A implements Serializable {
public function serialize($a) {}
public function unserialize($a) {}
}
$r = new ReflectionClass("A");
foreach($r->getMethods() as $method) {
echo $method->getDeclaringClass()->getName().'::'.$method->getName()."\n";
}