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
| public function processEditForm(\Nette\Application\UI\Form $form) { | |
| $mealcat = new \MealCategory($form->getValues()); | |
| try { | |
| $this->facade->saveCategory($mealcat); | |
| } catch (\Exception $e) { | |
| $this->flashMessage($e->getMessage(), 'alert-error'); | |
| $this->flashMessage('Bohužel, kategorii se nepodařilo uložit', 'alert-error'); | |
| $this->redirect('Mealcategory:overview'); | |
| } | |
| $this->flashMessage('Kategorie uložena', 'alert-success'); |
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
| // fce kterou volam | |
| function doSomething(callback) { | |
| // ... | |
| // volani callbacku | |
| callback('stuff', 'goes', 'here'); | |
| } | |
| // pripraveny callback | |
| function foo(a, b, c) { |
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
| // nejjednodusi zpusob | |
| function Thing(name) { | |
| this.name = name; | |
| } | |
| Thing.prototype.doSomething = function(callback) { | |
| // zavolani callbacku, this kuli kontextu | |
| callback.call(this); |
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
| chrome.manifest = function() { | |
| var manifestObject = false; | |
| var request = new XMLHttpRequest(); | |
| request.onreadystatechange = function() { | |
| if (request.readyState == 4) { | |
| manifestObject = JSON.parse(request.responseText); | |
| } | |
| }; |
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
| # Netrivialni dotazy | |
| ###########################x | |
| # 1) vypiste jmena odberatelu a pocet objednanych polozek (nerozlisujte zda jsou zaplaceny ci nikoliv) | |
| SELECT odberatel.jmeno, odberatel.prijmeni, COUNT( fakturapolozka.polozka_id ) AS pocet_polozek | |
| FROM odberatel | |
| LEFT JOIN faktura ON ( odberatel.odberatel_id = faktura.odberatel_id ) | |
| LEFT JOIN fakturapolozka ON ( faktura.cislo_faktury = fakturapolozka.cislo_faktury ) | |
| GROUP BY odberatel.odberatel_id |
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
| function makeLink($text){ | |
| $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; | |
| preg_match_all($reg_exUrl, $text, $url); | |
| foreach ($url[0] as $key => $value) { | |
| $text = strtr($text, array($value => '<a href="'.$value.'" target="_blank">'.$value.'</a>')); | |
| } | |
| return $text; | |
| } |
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 | |
| function trojuhelnik($a, $b, $c){ | |
| $arr = func_get_args(); // array($a, $b, $c); | |
| sort($arr); | |
| if(($arr[0] <= 0) || ($arr[0] + $arr[1] <= $arr[2])) | |
| throw new Exception("Trojuhelnik neni mozne sestrojit"); | |
| $arr = array_unique($arr); | |
| $result = array("rovnostranny","rovnoramenny","obecny"); | |
| return $result[count($arr)-1]; |
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
| # MySQL Server Instance Configuration File | |
| # ---------------------------------------------------------------------- | |
| # Generated by the MySQL Server Instance Configuration Wizard | |
| # | |
| # | |
| # Installation Instructions | |
| # ---------------------------------------------------------------------- | |
| # | |
| # On Linux you can copy this file to /etc/my.cnf to set global options, | |
| # mysql-data-dir/my.cnf to set server-specific options |
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 | |
| function __autoload($class_name) { | |
| $filename = __DIR__.DIRECTORY_SEPARATOR.strtolower($class_name).'.php'; | |
| if(is_readable($filename)) | |
| require ($filename); | |
| } |
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 | |
| $file1 = 'soubor1.txt'; | |
| $file2 = 'soubor2.txt'; | |
| // porovnani veliksoti souboru | |
| if(filesize($file1) == filesize($file2)){ | |
| echo 'jsou stejne'; | |
| } else { | |
| echo 'nejsou stejne'; |