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
<? | |
setlocale(LC_ALL, 'cs_CZ.UTF-8'); | |
header("content-type: text/html; charset=UTF-8"); | |
$arr = explode(",", "č, d, b, a, š, ř, o, x, z, ž, á, s, m"); | |
uasort($arr, "strcoll"); | |
echo "<pre>" . print_r($arr, 1) . "</pre>"; | |
?> |
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
(function(img) { | |
for (var i = img.length; i--; ) { | |
img[i].src = "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAAHAP8ALAAAAAABAAEAAAICRAEAOw=="; | |
} | |
})(document.images); |
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 check_alive($url, $timeout = 10, $successOn = array(200, 301)) { | |
$ch = curl_init($url); | |
// Set request options | |
curl_setopt_array($ch, array( | |
CURLOPT_FOLLOWLOCATION => false, | |
CURLOPT_NOBODY => true, | |
CURLOPT_TIMEOUT => $timeout, |
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 | |
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} | |
echo human_filesize(filesize('example.zip')); |
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 | |
$dom = new domDocument; | |
$csfd = file_get_contents("http://www.csfd.cz/film/$csfd_id"); | |
$html = (ord($csfd[0]) == 31) ? gzdecode($csfd) : $csfd; | |
@$dom->loadHTML($html); | |
$dom->preserveWhiteSpace = false; | |
$xpath = new DOMXPath($dom); | |
$nazvy = 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
{form $form} | |
<ul class=error n:if="$form->ownErrors"> | |
<li n:foreach="$form->ownErrors as $error">{$error}</li> | |
</ul> | |
<table> | |
<tr n:foreach="$form->controls as $input" n:class="$input->required ? required"> | |
<th>{label $input /}</th> | |
<td>{input $input} <span class=error n:ifcontent>{$input->error}</span></td> | |
</tr> |
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
$data = <<< DATA | |
<tr> | |
<td rowspan=6 align="center" valign="middle"><font size=-2>12. KOLO</font></td> | |
<td align="center"><font size=-2>10.9.</font></td> | |
<td align="center"><font size=-2>17:00</font></td> | |
<td align="left"><font size=-2>FC ŠEBÁNEK</font></td> | |
<td align="left"><font size=-2>ROZJETEJ STROJ</font></td> | |
<td align="right"><font size=-2><B> </B></font></td> | |
<td align="right"><font size=-2> </font></td> | |
<td align="left"><font size=-2> </font></td> |
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
class RowWrapper extends Nette\Object | |
{ | |
protected $row; | |
protected $data; | |
public function __construct(Nette\Database\Table\ActiveRow $row) | |
{ | |
$this->row = $row; | |
} |
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
$input = $form->addInput('text'); | |
$input->setDisabled(true); // nejdřív vypnout editaci | |
$input->setOmitted(false); // potom vypnout neodesílání |
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 @myArrayOfValue = '2,5,2,23,6,'; | |
WHILE (LOCATE(',', @myArrayOfValue) > 0) | |
DO | |
SET @value = ELT(1, @myArrayOfValue); | |
SET @myArrayOfValue= SUBSTRING(@myArrayOfValue, LOCATE(',',@myArrayOfValue) + 1); | |
INSERT INTO `EXEMPLE` VALUES(@value, 'hello'); | |
END WHILE; |