Skip to content

Instantly share code, notes, and snippets.

@mrook
mrook / trackedproj.java
Created August 30, 2017 19:59
Axon TrackingEventProcessor example
@Configuration
public class ProjectionsConfiguration {
@Autowired
private EventHandlingConfiguration eventHandlingConfiguration;
@Autowired
private EventStorageEngine eventStorageEngine;
@PostConstruct
public void startTrackingProjections() throws ClassNotFoundException {
@lsmith77
lsmith77 / DoctrineMigrationTest.php
Last active July 27, 2023 19:12
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
{
@Zenexer
Zenexer / escapeshellrce.md
Last active February 10, 2025 18:30
Security Advisory: PHP's escapeshellcmd and escapeshellarg are insecure

Paul Buonopane [email protected] at NamePros
PGP: https://keybase.io/zenexer

I'm working on cleaning up this advisory so that it's more informative at a glance. Suggestions are welcome.

This advisory addresses the underlying PHP vulnerabilities behind Dawid Golunski's [CVE-2016-10033][CVE-2016-10033], [CVE-2016-10045][CVE-2016-10045], and [CVE-2016-10074][CVE-2016-10074]. It assumes prior understanding of these vulnerabilities.

This advisory does not yet have associated CVE identifiers.

Summary

@webdevilopers
webdevilopers / RecordResultForm.php
Last active December 26, 2021 09:15
Dynamically add Elements to Symfony Form Collection without Data
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
final class RecordResult extends AbstractType
<?php
/**
* This is the clock interface. It's really simple, you write it once, use it anywhere.
* Cool extra things you can do:
* - have it return custom value objects
* - separate method for currentDate() without time part
*/
interface Clock
{
@creinartz
creinartz / .stylelintrc.json
Last active June 15, 2017 15:02
trivago CSS build demo
{
"plugins": [
"stylelint-declaration-use-variable"
],
"rules": {
"color-hex-case": ["lower", {"severity": "warning"} ],
"color-hex-length": ["short", {"severity": "warning"} ],
"color-named": ["never", {"severity": "warning"} ],
"time-no-imperceptible": [true, {"severity": "warning"} ],
"max-nesting-depth": [5, {"severity": "warning"} ],
@HarmJ0y
HarmJ0y / keepass2john.py
Created June 30, 2016 06:02
Python port of John the Ripper's keepass2john - extracts a HashCat/john crackable hash from KeePass 1.x/2.X databases
#!/usr/bin/python
# Python port of keepass2john from the John the Ripper suite (http://www.openwall.com/john/)
# ./keepass2john.c was written by Dhiru Kholia <dhiru.kholia at gmail.com> in March of 2012
# ./keepass2john.c was released under the GNU General Public License
# source keepass2john.c source code from: http://fossies.org/linux/john/src/keepass2john.c
#
# Python port by @harmj0y, GNU General Public License
#

Doctrine Translatable

With Translatable you can translate the fields you like in your Doctrine Entity. Check out other Doctrine Extensions

  • Official Doctrine Extensions installation guide here.
  • Official Doctrine Translatable documentation over here.

Installation

composer.json

@Ocramius
Ocramius / periodic-time-ticker.php
Last active April 14, 2017 17:48
A PHP long running process that fires a command at a command bus at regular time intervals
#!/usr/bin/env php
<?php
declare(strict_types=1);
namespace CodeReviewsIo\Worker;
use CodeReviewsIo\Domain\Command\TickTime;
use Prooph\ServiceBus\CommandBus;
use React\EventLoop\Factory;
/**
* @param string $absolutePathToCsvFile
* @param string $csvFilename
* @return array $data
* @throws Exception $e
*/
private static function readCsvFile($absolutePathToCsvFile, $csvFilename)
{
try {
$data = array_map('str_getcsv', file($absolutePathToCsvFile . '/' . $csvFilename));