Skip to content

Instantly share code, notes, and snippets.

@mablae
mablae / register.html.twig
Created October 17, 2018 00:55 — forked from ThePeterMick/register.html.twig
Display label and checkbox separately for bootstrap 4 in Twig for Symfony 4
{% form_theme form _self %}
{% block checkbox_widget -%}
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
{%- if 'checkbox-custom' in parent_label_class -%}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%}
<div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' custom-control-inline' }}">
{{ block('checkbox_widget_base') }}
</div>
{%- else -%}
ffmpeg -i 01\ -\ Green\ Beret\ Loading\ Theme.flac \
-map 0:1 \
-c:a:0 alac \
01\ -\ Green\ Beret\ Loading\ Theme.m4a
@mablae
mablae / DefText.c
Created November 8, 2017 17:45 — forked from taviso/DefText.c
NtUserDefSetText() in Windows 10 will panic if you set the ansi flag incorrectly.
#include <windows.h>
#include <winternl.h>
#include <stdio.h>
#pragma comment(lib, "user32")
#pragma comment(lib, "gdi32")
typedef struct _LARGE_STRING {
ULONG Length;
ULONG MaximumLength:31;
@mablae
mablae / AuthenticationContext.php
Created October 26, 2017 00:23 — forked from jakzal/AuthenticationContext.php
Logging user into a Symfony app in Behat
<?php
namespace Acme\Context;
use Acme\MyApp\User;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Doctrine\ORM\EntityManager;
use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;
use Symfony\Component\HttpKernel\KernelInterface;
@mablae
mablae / RecentContractsBlockService.php
Created October 15, 2017 18:04 — forked from webdevilopers/RecentContractsBlockService.php
Sonata Admin - Include custom block / list view in edit template
<?php
namespace Plusquam\Bundle\ContractBundle\Block;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
@mablae
mablae / trackedproj.java
Created August 30, 2017 20:03 — forked from mrook/trackedproj.java
Axon TrackingEventProcessor example
@Configuration
public class ProjectionsConfiguration {
@Autowired
private EventHandlingConfiguration eventHandlingConfiguration;
@Autowired
private EventStorageEngine eventStorageEngine;
@PostConstruct
public void startTrackingProjections() throws ClassNotFoundException {
@mablae
mablae / trackedproj.java
Created August 30, 2017 20:03 — forked from mrook/trackedproj.java
Axon TrackingEventProcessor example
@Configuration
public class ProjectionsConfiguration {
@Autowired
private EventHandlingConfiguration eventHandlingConfiguration;
@Autowired
private EventStorageEngine eventStorageEngine;
@PostConstruct
public void startTrackingProjections() throws ClassNotFoundException {
@mablae
mablae / DoctrineMigrationTest.php
Created July 24, 2017 18:06 — forked from lsmith77/DoctrineMigrationTest.php
PHPUnit functional test to check if migrations inside a Symfony app
<?php
namespace AppBundle\Tests;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\DBAL\Driver\PDOMysql\Driver as MySQLDriver;
class DoctrineMigrationTest extends WebTestCase
{
@mablae
mablae / SortableDirectoryIterator.php
Created June 23, 2017 20:30 — forked from DragonBe/SortableDirectoryIterator.php
Sortable DirectoryIterator based on last modification time
class SortableDirectoryIterator extends RecursiveDirectoryIterator
{
/**
* \ArrayObject
*/
private $dirArray;
public function __construct(string $path)
{
parent::__construct($path);
@mablae
mablae / Bootstrap.php
Created March 20, 2017 06:18 — forked from Ocramius/Bootstrap.php
ZF2 and Doctrine Data Fixtures testing environment
<?php
/**
* @author Marco Pivetta <[email protected]>
*/
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
use DoctrineORMModuleTest\Framework\TestCase;
use ContentTest\Util\ServiceManagerFactory;
use Zend\Loader\StandardAutoloader;