Skip to content

Instantly share code, notes, and snippets.

View fprochazka's full-sized avatar
🏠
Working from home

Filip Procházka fprochazka

🏠
Working from home
View GitHub Profile
<?php
/**
* @see https://github.com/HosipLan/Nette-addDynamic
*/
class CreatePresenter extends BasePresenter
{
protected function startup()
{
@fprochazka
fprochazka / BasePresenter.php
Created April 14, 2011 12:14 — forked from PJK/BasePresenter.php
TwigMacro
<?php
public function templatePrepareFilters($template) {
$template->registerFilter($latte = new Nette\Templates\LatteFilter());
TwigMacro::register($latte->getHandler());
}
<?php
use Doctrine\ORM\Query\Expr\Join;
class OfferFinder extends Blabla
{
public function whereTags(array $tags)
{
<?php
// new movie
$movie = new Entities\Movie;
$movie->name = 'Pulp Fiction';
// new director
$movie->director = new Entities\Director;
$movie->director->name = 'Quentin Tarantino';
<?php
namespace NetteExtras\Forms;
class ChangeTracker extends \Nette\Forms\HiddenField
{
private $session;
private $modifiedValues;
@fprochazka
fprochazka / FormMacros.php
Created August 14, 2010 23:25 — forked from janmarek/FormMacros.php
FormMacros
<?php
namespace Nette\Templates;
use Nette\Forms\Form;
use Nette\String;
/**
* Form macros
*
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
import Kefir from 'kefir';
import {List, Stack} from 'immutable';
import {comp, filter, map} from 'transducers-js';
function register(stream, messageType, handler) {
let xform = comp(
filter(x => x.first() === messageType),
map(x => x.rest()));
stream.transduce(xform).onValue(handler);
}
<?php
require __DIR__ . '/../vendor/autoload.php';
$configurator = new Nette\Configurator;
$configurator->setDebugMode(TRUE); // debug mode MUST NOT be enabled on production server
$configurator->enableDebugger(__DIR__ . '/../log');
$configurator->setTempDirectory(__DIR__ . '/../temp');