This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\UserBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use FOS\UserBundle\Model\User as BaseUser; | |
/** | |
* User | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Updated: 2010/12/05 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it) | |
// | |
// Permission is hereby granted, free of charge, to any person |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Based on http://www.wenigersh.com/blog/post/maintenance-mode-for-symfony-2-applications | |
* | |
* Includes support of user permisson check (here: check if user has role ADMIN), so admins can still surf the site while in maintenance mode | |
* Be aware that if you clear the cache (to start maintenance in prod environment) your sessions might be cleared as well, so people get logged out | |
* The config.yml will move the sessions to /app/sessions/[environment] | |
* | |
* Also be aware that you need at least Symfony 2.6 for this permission check. For older versions the call is different | |
* @see http://symfony.com/blog/new-in-symfony-2-6-security-component-improvements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LocaleListener implements EventSubscriberInterface | |
{ | |
private $defaultLocale; | |
public function __construct($defaultLocale = User::DEFAULT_LOCALE) | |
{ | |
$this->defaultLocale = $defaultLocale; | |
} |