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 | |
//regex test: http://regexhero.net/tester/?id=c4b2c455-b1e3-40b8-969e-b5b8240b7324 | |
public static function twitterify($text) { | |
$search = array( | |
'|(http://[^ ]+)|', | |
'/(^|[^a-z0-9_])@(\w*[a-z]+[0-9a-ž_]*)/i', | |
'/(^|[^a-z0-9_])#(\w*[a-z]+[0-9a-ž_]*)/i', | |
); | |
$replace = 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
<?php | |
public static function scanDir($patch, $pattern = false, $ignore = false){ | |
$dir = new RecursiveDirectoryIterator($patch); | |
if( !$dir->isDir() ) throw new FileModelException("$patch must by directory"); | |
$files= array(); | |
foreach ($dir as $filename => $cur) { | |
if($ignore && in_array($file, $ignore)) continue; | |
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
#!/bin/bash | |
# My first shell script :) | |
# Backup domains directories and MySQL database. | |
clear | |
# CONFIGURATION | |
MODE_D="0740" | |
MODE_F="0640" | |
DAY=$(date +%F) # YYYY-MM-DD |
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
var secure = true; | |
var files = [{ | |
"name" : "file1.txt", | |
"contents" : "foo1", | |
"ext" : "txt", | |
}, { | |
"name" : "file2.php", | |
"contents" : "<?php phpinfo();", | |
"ext" : "php", |
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
int pridano = 0; | |
for( .... .... ..){ | |
if(platy[pocet] > 10000){ | |
pridano++; | |
} | |
} |
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 | |
/** | |
* Draft for EditableGrid | |
* @author Pavel Máca | |
*/ | |
$grid = new Gridito\EditableGrid($this, $name); | |
$em = Nette\Environment::getService("Doctrine\ORM\EntityManager"); | |
$model = new Model\UsersEditableGriditoDoctrineModel($em); | |
$grid->setModel($model); |
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
/** | |
* HOW-TO | |
*/ | |
// same param as $.ajax(option); see http://api.jquery.com/jQuery.ajax/ | |
$.ajaxQueue.addRequest(option); | |
// start processing one by one requests | |
$.ajaxQueue.run(); |
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 | |
/** | |
* Expands %placeholders% in string. Return mixed when expanding pure ^%item%$. | |
* @param string | |
* @return mixed | |
* @throws Nette\InvalidStateException | |
*/ | |
public function expand($s) | |
{ |
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 | |
/** | |
* Returns array item or $default if item is not set. | |
* Example: $val = Arrays::get($arr, 'i', 123); | |
* @param mixed array | |
* @param mixed key | |
* @param mixed default value | |
* @return mixed | |
*/ | |
public static function get(array $arr, $key, $default = NULL) |
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 XYZ{ | |
public function foo(){ | |
wc(); | |
} | |
} |
OlderNewer