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 | |
/** | |
* ClassLoader implements a PSR-0 class loader | |
* | |
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md | |
* | |
* $loader = new \Composer\Autoload\ClassLoader(); | |
* | |
* // register classes with namespaces |
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
// // JavaScript I wrote to limit what types of input are allowed to be keyed into a textbox | |
// var allowedSpecialCharKeyCodes = [46,8,37,39,35,36,9]; | |
// var numberKeyCodes = [44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105]; | |
function numbersOnly(event) { | |
var legalKeyCode = | |
(!event.shiftKey && !event.ctrlKey && !event.altKey) | |
&& | |
(jQuery.inArray(event.keyCode, allowedSpecialCharKeyCodes) >= 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
svn st | awk '{if ( $1 == "?") { print $2}}' | xargs svn add |
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
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg |
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 | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |
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
svn st | grep "^\?" | awk "{print \$2}" | xargs svn add $1 |
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/sh | |
DB_USER="mysql_user_name" | |
DB_PASS="mysql_password" | |
BK_DIR="/backup_dir" | |
MYSQL_PATH="/usr/local/mysql/bin" | |
DATE=`date +%F` | |
DIR="$BK_DIR/$DATE" | |
if [ ! -d "$DIR" ];then |
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/sh | |
a=`ps aux | grep -c 'sqs_daemon_beta'` | |
if [ $a = 1 ] | |
then | |
nohup /usr/local/php/bin/php /data/kishioo/sqs_daemon_beta.php -c /data/kishioo/web/config/sqs_conf.php 2>&1 >> /tmp/sqs.log & | |
fi |
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/sh | |
target=`pwd` | |
find $target -type d -name .svn | while read i | |
do | |
rm -rf '$i' | |
echo "$i deleted!" | |
done | |
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 | |
$smarty->register_prefilter('smarty_fix_include'); | |
function smarty_fix_include($out_put, &$smarty) | |
{ | |
// 找出所有的include标签,并找出file | |
return preg_replace_callback('/\{include\s+.*?file=[\'"]*(.+)[\'"]*\}/i', 'smarty_fix_include_callback', $out_put); | |
} | |
function smarty_fix_include_callback($match) |
NewerOlder