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 | |
// Nette/Latte/Macros/UIMacros - after line 507 | |
$httpParams = $control->getPresenter()->getContext()->httpRequest->getQuery(); | |
foreach ($control->getComponents(FALSE, 'Nette\Application\UI\Multiplier') as $multiplier) { | |
foreach ($httpParams as $param => $signal) { | |
if ($param == 'do' && Strings::startsWith($signal, $multiplier->getName()) && ($pos = strrpos($signal, '-')) !== FALSE) { | |
$child = $control->getComponent(substr($signal, 0, $pos)); | |
$child->snippetMode = 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
{* with helper *} | |
<div id="with-data" data-example="{[a => b]|data}"></div> | |
{* with macro *} | |
<div id="with-data" n:data="example, [a => b]"></div> | |
<script> | |
var data = parseDataJson($('#with-data'), 'example'); | |
// => data == {a: 'b'} | |
</script> |
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 Clevispace; | |
use Nette\DI; | |
class ComponentFactory extends DI\Container | |
{ |
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
SELECT `*` FROM `users` WHERE `username` = "john@doe.com" AND `password` = "xxx" |
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
{* | |
* All ui:* macros should support basic HTML attributes as modificators, | |
* because in fact they are only abstractions of common HTML elements | |
* compatible with proper unobtrusive javascript service. | |
*} | |
{* | |
* Basic link | |
* 'href' attribute is automatically evaluated as 'n:href' | |
*} |
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 | |
# low-level | |
$feanorm->relate($article)->to($category)->on('categories'); | |
$feanorm->unrelate($article)->to($category)->on('categories'); | |
// The clause 'on' shouldn't be neccessary when only one relation between entities is present. | |
# practical api |
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 | |
use Nette\Application\AppForm; | |
use Nette\Application\Control; | |
use Nette\Environment; | |
class Questions extends Control | |
{ | |
const YES = 'yes'; |
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 | |
trait Decorator | |
{ | |
/** @var object */ | |
private $decorated; | |
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
[].slice.call(document.querySelectorAll('pre'), 0).forEach(function (el) { | |
el.innerHTML = el.innerHTML.split("\n").join('<br>'); | |
}); | |
var style = document.createElement("style"); | |
style.appendChild(document.createTextNode("")); | |
document.head.appendChild(style); | |
style.sheet.insertRule("pre { white-space: normal }", 0); |
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 | |
// $selection instanceof DibiFluent | |
$filter = FilterHelper::start($selection, $filter) | |
->add('start_date')->setRule('[b.start_date] >= %d') | |
->add('end_date')->setRule('[b.end_date] <= %d') | |
->end(); |