Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

Pedro Luz Narven

👾
Walking to the fridge...
View GitHub Profile
$ curl --data-binary @README.md -H 'Content-Type:text/plain' https://api.github.com/markdown/raw
acme_generate_image_service:
class: Acme\Component\GenerateImageConsumer
arguments:
- @logger
<?php
namespace Acme\Component;
use OldSound\RabbitMqBundle\RabbitMq\Producer;
class UploadImage
{
protected $options = array();
protected $generateFolder = null;
(e.g. for email templates)
Just set the assets_base_urls option under framework - templating key in your app/config/config.yml:
framework:
templating:
assets_base_urls: http://www.something.com/web/
http://symfony.com/doc/current/reference/configuration/framework.html#assets-base-urls
<?php
// src/Bundle/Form/EventListener/AddExpiresAtFieldSubscriber.php
class AddExpiresAtFieldSubscriber implements EventSubscriberInterface
{
private $factory;
public function __construct(FormFactoryInterface $factory)
{
$this->factory = $factory;
<?php
try{
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->get('session')->setFlash('notice', 'Article inserted!');
return $this->redirect($this->generateUrl('article_show', array('id' => $entity->getId())));
}catch(\Exception $e){
tr:nth-child(2n+1){ background: ‪#fff‬ }
tr:nth-child(2n+0){ background: ‪#ffffec‬ }
<?php
class TimeoutException extends RuntimeException {}
class Timeout
{
private $active;
public function set($seconds)
{
$ echo cmd | at 5am next year
@Narven
Narven / gist:4805e1391a90164c3d0d
Created June 30, 2014 14:01
puppet agent conf
# The configuration file for agent. Note that this file
# is likely to have unused configuration parameters in it; any parameter that's
# valid anywhere in Puppet can be in any config file, even if it's not used.
#
# Every section can specify three special parameters: owner, group, and mode.
# These parameters affect the required permissions of any files specified after
# their specification. Puppet will sometimes use these parameters to check its
# own configured state, so they can be used to make Puppet a bit more self-managing.
#
# Generated on 2012-05-21 11:08:46 +0200.