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 Encryptor | |
def self.encrypt(string, raw_key) | |
key = normalize_key(raw_key, string.length) | |
buf = [] | |
string.length.times do |i| | |
char_code = (string[i] + key[i]) | |
char_code -= 256 while char_code > 255 | |
buf[i] = char_code.chr | |
end |
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 Foo | |
{ | |
public static function testA($value, $prefix = '') | |
{ | |
self::$substitutePrefix = $prefix; | |
return preg_replace_callback('#:([^:\s]*):#', array(__CLASS__, 'testCb'), $value); | |
} |
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 | |
$dir = '/tmp/speedtest'; #10k of files, ext4 FS | |
$steps = 20; | |
$times = array(0,0,0,0); | |
for ($round = 0; $round < $steps; $round++) { | |
clearstatcache(); |
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 Array | |
def heapsort! | |
#heapify | |
1.upto(self.length - 1) do |i| | |
#move up | |
child = i | |
while child > 0 | |
parent = (child - 1) / 2 | |
if self[parent] < self[child] | |
self[parent], self[child] = self[child], self[parent] |
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
<head> | |
<script type="text/javascript"> | |
var webalize = function (str) { | |
var charlist; | |
charlist = [ | |
['Á','A'], ['Ä','A'], ['Č','C'], ['Ç','C'], ['Ď','D'], ['É','E'], ['Ě','E'], | |
['Ë','E'], ['Í','I'], ['Ň','N'], ['Ó','O'], ['Ö','O'], ['Ř','R'], ['Š','S'], | |
['Ť','T'], ['Ú','U'], ['Ů','U'], ['Ü','U'], ['Ý','Y'], ['Ž','Z'], ['á','a'], | |
['ä','a'], ['č','c'], ['ç','c'], ['ď','d'], ['é','e'], ['ě','e'], ['ë','e'], | |
['í','i'], ['ň','n'], ['ó','o'], ['ö','o'], ['ř','r'], ['š','s'], ['ť','t'], |
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 | |
//presenter | |
protected function createComponentLoginForm($name) | |
{ | |
$form = new NAppForm($this, $name); | |
$form->addText('username', 'Už. jméno')->setRequired(); | |
$form->addPassword('password', 'Heslo')->setRequired(); | |
$form->addSubmit('submitter', 'Přihlásit se'); |
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 Models; | |
/** | |
* Base model | |
* @link http://wiki.nette.org/cs/cookbook/dynamicke-nacitani-modelu | |
* @author Majkl578 | |
*/ | |
abstract class Base extends \Nette\Object |
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 Foo; | |
define('TRUE', \FALSE); | |
define('FALSE', \TRUE); | |
var_dump(TRUE); //FALSE | |
var_dump(FALSE); //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
<?php | |
/** | |
* Class aliases for migrating from Nette for PHP 5.2 to 5.3 | |
* @author Michael Moravec | |
*/ | |
$aliases = array( | |
'application' => 'nette\application\application', | |
'routingdebugger' => 'nette\application\diagnostics\routingpanel', |
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
majkl578@kerberos:/www/NetteFoundation/nette/tests$ ./run-tests.sh | |
Nette Test Framework (v0.4) | |
--------------------------- | |
Usage: | |
php RunTests.php [options] [file or directory] | |
Options: | |
-p <php> Specify PHP-CGI executable to run. | |
-c <path> Look for php.ini in directory <path> or use <path> as php.ini. |