This file contains 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
var eventDispatcher = function() { | |
var events = {}; | |
var getEvent = function(name) { | |
if ( ! events[name]) { | |
events[name] = $.Callbacks(); | |
} | |
return events[name]; | |
}; | |
var addListener = function(eventName, fn) { | |
getEvent(eventName).add(fn); |
This file contains 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 | |
$numcols = intval($argv[1]) or die('provide a total column #'); | |
$items = range('a', 'z'); | |
$itemsPerCol = ceil(count($items) / $numcols); | |
for ($i = 1; $i <= $numcols; $i++) { | |
$start = ($i - 1) * $itemsPerCol; | |
$colItems = array_slice($items, $start, $i == $numcols ? null : $itemsPerCol); | |
echo sprintf('Column %d is %d items', $i, count($colItems)); |
This file contains 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
{% set _isAuthenticated = app.user and is_granted("IS_AUTHENTICATED_REMEMBERED") %} | |
<ul> | |
{% if _isAuthenticated %} | |
<li><a href="{{ path('fos_user_security_logout') }}">Logout</a></li> | |
<li class="divider">|</li> | |
<li><a href="{{ path('fos_user_profile_edit') }}"><span class="truncate">My </span>Account</a></li> | |
{% else %}{# not authenticated #} | |
<li><a href="{{ path('fos_user_security_login') }}">Login</a></li> | |
{% endif %} |
This file contains 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 ContentAwareFactory extends RouterAwareFactory | |
public function createFromNode(NodeInterface $node) | |
{ | |
$item = $this->createItem($node->getName(), $node->getOptions()); | |
if (empty($item)) { | |
return null; |
This file contains 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
app/console doctrine:database:drop -e=test --force | |
app/console doctrine:database:create -e=test | |
app/console doctrine:phpcr:init:dbal -e=test | |
app/console doctrine:phpcr:workspace:create standard_test -e=test | |
app/console doctrine:phpcr:repository:init -e=test |
This file contains 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 StaffController | |
{ | |
/** | |
* @Route("/about/{slug}", name="staff_detail") | |
* @ParamConverter("staff", class="VdwStaffBundle:Staff") | |
* @Cache(expires="tomorrow", public="true") | |
*/ |
This file contains 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
public function addRouteEnhancer(RouteEnhancerInterface $enhancer, $priority = 0) | |
{ | |
echo get_class($enhancer); | |
echo PHP_EOL; | |
if (empty($this->enhancers[$priority])) { | |
$this->enhancers[$priority] = array(); | |
} | |
$this->enhancers[$priority][] = $enhancer; | |
$this->sortedEnhancers = array(); |
This file contains 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
<service id="vdw_cms.route_enhancer.website_template" class="Vdw\CmsBundle\Enhancer\WebsiteTemplateEnhancer"> | |
<argument type="service" id="vdw_cms.manager.website" /> | |
<tag name="dynamic_router_route_enhancer" priority="50" /> | |
</service> |
This file contains 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
security: | |
access_decision_manager: | |
strategy: unanimous |
This file contains 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 Application\Migrations; | |
use Doctrine\DBAL\Migrations\AbstractMigration, | |
Doctrine\DBAL\Schema\Schema; | |
/** | |
* Auto-generated Migration: Please modify to your need! | |
*/ |