Skip to content

Instantly share code, notes, and snippets.

View johnkary's full-sized avatar

John Kary johnkary

View GitHub Profile
services:
acme_hello.my_service:
class: Acme\HelloBundle\MyService
arguments: [%acme_hello.my_service_type%]
@johnkary
johnkary / StudentChangeSubscriber.php
Created November 21, 2012 19:37
Doctrine listener for audit log functionality
<?php
namespace Acme\StudentBundle\Listener;
use Doctrine\Common\EventSubscriber,
Doctrine\ORM\Events,
Doctrine\ORM\Event\OnFlushEventArgs,
Doctrine\ORM\EntityManager,
DoctrineExtensions\Versionable\Entity\ResourceVersion;
@johnkary
johnkary / ReadOnlyFieldSubscriber.php
Created November 30, 2012 16:09
Display read-only Phone Number field in browser, while disallowing editing via form, even if user modifies the DOM to remove the readonly attribute
<?php
namespace Acme\UserBundle\Listener;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
@johnkary
johnkary / config.yml
Created December 5, 2012 09:20
Stylesheet including for alex88
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
filters:
lessphp:
file: "%kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php"
apply_to: "\.less$"
cssrewrite: ~
cssembed:
@johnkary
johnkary / vagrant-nfs-vpn-solution.md
Last active April 8, 2020 10:30
Workaround for using an NFS mount with Vagrant and VirtualBox while connecting to a VPN network restricting local network connections

Fixing NFS disconnecting with Vagrant and VirtualBox on Mac OS

Symptoms and Known Conditions

  • Mac OS host machine (10.6+)
  • VirtualBox (4.1+)
  • Vagrant (1.0+)
  • Connecting via VPN to a remote network
  • Mounting a directory from your host machine to the guest machine using NFS with something like this:
@johnkary
johnkary / readme.md
Last active December 14, 2015 01:29
Use Alfred App to search Packagist.org for packages to install via Composer

Search Packagist.org with Alfred App

Alfred > Preferences > Features > Custom Web Searches

Click the following link to add the custom web search: alfredapp://customsearch/Search%20Packagist%20for/packagist/ascii/url=http://packagist.org/search/?q={query}

Now use it by opening Alfred's search box and typing packagist [vendor/package-name]

@johnkary
johnkary / composer.json
Last active December 14, 2015 22:08
Composer not installing bugfix branch for imag/ldap-bundle
{
"name": "mopa/symfony-bootstrap",
"description": "The \"Symfony Standard Edition\" distribution enriched with twitter/bootstrap2",
"autoload": {
"psr-0": { "": "src/" }
},
"minimum-stability": "stable",
"repositories": [
{
"type": "package",
@johnkary
johnkary / LdapSecurityListener.php
Created April 30, 2013 03:04
BorisMorel/LdapBundle - PRE_BIND listener as a service with database access
<?php
namespace Acme\SystemBundle\Listener;
use Acme\SystemBundle\Entity\UserAccess;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use IMAG\LdapBundle\Event\LdapEvents;
use IMAG\LdapBundle\Event\LdapUserEvent;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@johnkary
johnkary / parse.php
Last active December 17, 2015 10:39
Parse square brackets node list for @juantreminio
<?php
$body = <<<XML
[Section 1]
Key 2.0=Value 2.0
Key 2.2=Value 2.2
Key 2.1=Value 2.1
[/Section 1]
[Section 2]
Key 1.1=Value 1.1
@johnkary
johnkary / symfony-live-2013-portland.md
Last active December 17, 2015 15:29
Slides from Symfony Live 2013 - Portland