Skip to content

Instantly share code, notes, and snippets.

View File.orm.yml
App\Model\File:
type: entity
table: files
entityListeners:
App\Doctrine\EventListener\FileUploadListener:
prePersist: [upload]
preUpdate: [upload]
preRemove: [remove]
id:
id:
View PromotionExpressionValidator.php
<?php
class PromotionExpressionValidator extends ConstraintValidator
{
private $expressionLanguage;
private $loadDummyOrder;
public function __construct(
ExpressionLanguage $expressionLanguage,
LoadDummyOrder $loadDummyOrder
View appProdProjectContainer.php
protected function getTranslator_DefaultService()
{
$this->services['translator.default'] = $instance = new \Symfony\Bundle\FrameworkBundle\Translation\Translator($this, new \Symfony\Component\Translation\MessageSelector(), array('translation.loader.php' => array(0 => 'php'), 'translation.loader.yml' => array(0 => 'yml'), 'translation.loader.xliff' => array(0 => 'xlf', 1 => 'xliff'), 'translation.loader.po' => array(0 => 'po'), 'translation.loader.mo' => array(0 => 'mo'), 'translation.loader.qt' => array(0 => 'ts'), 'translation.loader.csv' => array(0 => 'csv'), 'translation.loader.res' => array(0 => 'res'), 'translation.loader.dat' => array(0 => 'dat'), 'translation.loader.ini' => array(0 => 'ini')), array('cache_dir' => (__DIR__.'/translations'), 'debug' => false));
$instance->setFallbackLocales(array(0 => 'en'));
$instance->addResource('xlf', (dirname(dirname(dirname(__DIR__))).'/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf'), 'sv', 'validators
@umpirsky
umpirsky / gifify.sh
Created Jun 25, 2014
Convert all jpg images from folder into animated gif.
View gifify.sh
#!/bin/sh
mogrify -verbose -resample 72x72 -resize 512x512 *.jpg
exiftran -a -no -i *.jpg
convert -verbose -delay 15 -loop 0 *.jpg fun.gif
@umpirsky
umpirsky / grub
Created Jun 14, 2014
Reinstall GRUB
View grub
sudo mount /dev/dm-2 /mnt
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/dm-2
@umpirsky
umpirsky / instructions.md
Created Apr 29, 2014
PermissionsHandler test.
View instructions.md

Steps to test PermissionsHandler script:

$ git clone git@github.com:umpirsky/symfony-standard.git symfony-standard.dev
$ cd symfony-standard.dev
$ git checkout feature/permissions-handler
$ composer install
$ cd web
$ php -S localhost:8888
$ chromium-browser http://localhost:8888/config.php (or whatever web browser)
@umpirsky
umpirsky / A.markdown
Last active Jan 14, 2022 — forked from olivierlacan/An_example.markdown
Sublime Text Monokai Sidebar Theme.
View A.markdown
@umpirsky
umpirsky / kill-me-please
Created Apr 18, 2013
After running this recursive script on Linux, you are screwed!
View kill-me-please
#!/bin/bash
./kill-me-please
View update
#!/bin/bash
./bin/update