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
grep -rl "'filter'=>FrontEnd::createPhInputField" * | grep -v ".svn" | xargs -l sed -i "s/filter'=>FrontEnd::createPhInputField(\(.*\),\(.*\))/filter'=>FrontEnd::createPhInputField(\1,\2,\$filtersForm)/g" |
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
# Source: http://blog.x-if.com/2010/12/find-utf-8-files-with-bom/ | |
# http://stackoverflow.com/questions/204765/elegant-way-to-search-for-utf-8-files-with-bom | |
find -type f|while read file;do [ "`head -c3 -- "$file"`" == $'xefxbbxbf' ] && echo "found BOM in: $file";done | |
grep -orHbm1 "^`echo -ne 'xefxbbxbf'`" . | sed '/:0:/!d;s/:0:.*//' | |
# most efficient way: | |
find . -type f -print0 | xargs -0r awk '/^xEFxBBxBF/ {print FILENAME} {nextfile}' |
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
// source: http://www.php.net/manual/en/function.ldap-delete.php | |
function myldap_delete($ds,$dn,$recursive=false){ | |
if($recursive == false){ | |
return(ldap_delete($ds,$dn)); | |
}else{ | |
//searching for sub entries | |
$sr=ldap_list($ds,$dn,"ObjectClass=*",array("")); | |
$info = ldap_get_entries($ds, $sr); | |
for($i=0;$i<$info['count'];$i++){ |
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 Lock | |
* Script locking mechanism for one-time-running scripts. | |
*/ | |
class Lock | |
{ | |
private $fp; | |
function __construct() |
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
# ES version: 0.90.5 | |
# /etc/init.d/elasticsearch | |
ES_HEAP_SIZE=4g |
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
/** | |
* @source: http://codeaid.net/php/convert-size-in-bytes-to-a-human-readable-format-(php) | |
*/ | |
function bytesToSize1024($bytes, $precision = 2) | |
{ | |
$unit = array('B','KB','MB','GB','TB','PB','EB'); | |
return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), $precision).' '.$unit[$i]; | |
} |
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
// Source: http://stackoverflow.com/a/356431 | |
class B { | |
public function method_from_b($s) { | |
echo $s; | |
} | |
} | |
class C { | |
public function method_from_c($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
@source: http://php.net/manual/en/function.readfile.php | |
<?php | |
$file = 'monkey.gif'; | |
if (file_exists($file)) { | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.basename($file)); | |
header('Expires: 0'); |
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
@source: http://www.naveen.com.au/javascript/jquery/encode-or-decode-html-entities-with-jquery/289 | |
function htmlEncode(value){ | |
if (value) { | |
return jQuery('<div />').text(value).html(); | |
} else { | |
return ''; | |
} | |
} | |
OlderNewer