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 | |
function verifyIC($ic) | |
{ | |
// be liberal in what you receive | |
$ic = preg_replace('#\s+#', '', $ic); | |
// má požadovaný tvar? | |
if (!preg_match('#^\d{8}$#', $ic)) { | |
return FALSE; |
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 | |
var_dump(Test::$table); // dumps empty array() | |
class Test | |
{ | |
static $table = array( | |
'_0' => 1, '_1' => 1, '_2' => 1, '_3' => 1, '_4' => 1, '_5' => 1, '_6' => 1, '_7' => 1, '_8' => 1, '_9' => 1, | |
'_10' => 1, '_11' => 1, '_12' => 1, '_13' => 1, '_14' => 1, '_15' => 1, '_16' => 1, '_17' => 1, '_18' => 1, '_19' => 1, |
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 | |
function foo(int $bar) : int { | |
return $bar * 2; | |
} | |
var_dump( foo(2.5) ); // int(4) and triggers E_NOTICE - great! | |
// but without E_NOTICE it as bad as: | |
var_dump( foo((int) 2.5) ); |
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
<td><span class=select>[email protected]</span></td> | |
<script> | |
$('.select').click(function(){ | |
var range = document.createRange(); | |
range.selectNodeContents(this); | |
window.getSelection().addRange(range); | |
}); |
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
services: | |
newsletter_factory: NewsletterFactory | |
newsletter_manager: @newsletter_factory::get(@templating) | |
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
# spaces are OK | |
- key1: # empty means NULL | |
key2: hello | |
key3: 123 | |
# tabs are confusing | |
- key1: | |
key2: hello |
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
services: | |
- RouterFactory()::createRouter(%mode%)::start() | |
- MyClass( @service(123)::foo(), abc ) |
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 FooControl extends Nette\Application\UIControl | |
{ | |
public function render() | |
{ | |
MyTemplate::registerFilters($this->template) | |
->render(__DIR__ . '/control.latte'); | |
} |
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
<table n:if="$items"> | |
<tr n:foreach="$items as $item"> | |
<td>{$item->title}</td> | |
... | |
</tr> | |
</table> |
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 | |
/** | |
* This file is part of the Nette Tester. | |
* Copyright (c) 2009 David Grudl (http://davidgrudl.com) | |
*/ | |
namespace Tester; | |