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
/** | |
* | |
* 打印调试日志 | |
* @param string $errmsg | |
*/ | |
function new_debug($msg) { | |
$info = debug_backtrace (); | |
$file = $info [0] ['file']; | |
$line = $info [0] ['line']; | |
if (is_array ( $msg ) || is_object ( $msg )) { |
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
window.onload = addListeners; | |
function addListeners() { | |
document.getElementById('dxy').addEventListener('mousedown', mouseDown, false); | |
window.addEventListener('mouseup', mouseUp, false); | |
} | |
function mouseUp() { | |
window.removeEventListener('mousermove', divMove, 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
bool isLoop( link* head) | |
{ | |
link* s = head; //移动缓慢的指针 | |
link* f = head; //移动快速的指针 | |
do | |
{ |
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
//这个函数还有个bug,就是当输入的数组为[new String(1), new Number(1)]时,无法区别 | |
function uniqueArr(arr) { | |
var n = {}; | |
var r = []; | |
arr.forEach(function(v){ | |
var key = typeof(v) + v; | |
if (!n[key]) { | |
n[key] = true | |
r.push(v) |
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
typedef struct node{ | |
int val; | |
struct node *next; | |
}node; | |
void reverse(node *currentNode) | |
{ | |
node *preNode = NULL; | |
node *nextNode = 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
/*归并排序*/ | |
void MergeSort(struct node** headRef) | |
{ | |
struct node* head = *headRef; | |
struct node* a; | |
struct node* b; | |
/*base case-- length 0 or 1 */ | |
if((head == NULL) || (head->next == 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
# Remove previous installations | |
sudo apt-get remove vim vim-runtime vim-tiny vim-common | |
# Install dependencies | |
sudo apt-get install libncurses5-dev python-dev libperl-dev ruby-dev liblua5.2-dev | |
# Fix liblua paths | |
sudo ln -s /usr/include/lua5.2 /usr/include/lua | |
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/local/lib/liblua.so |
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 | |
# 以下配置信息请自己修改 | |
mysql_user="root" #MySQL备份用户 | |
mysql_password="123" #MySQL备份用户的密码 | |
mysql_host="localhost" | |
mysql_port="3306" | |
mysql_charset="utf8" #MySQL编码 | |
backup_db_arr=("infos") #要备份的数据库名称,多个用空格分开隔开 如("db1" "db2" "db3") | |
backup_location=/home/clinyong/backup/mysql #备份数据存放位置,末尾请不要带"/",此项可以保持默认,程序会自动创建文件夹 |
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
func showSignature(any interface{}) string{ | |
fn := reflect.ValueOf(any) | |
if fn.Kind() != reflect.Func { | |
return | |
} | |
sig := fn.Type().String() | |
return sig | |
} |
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
# add following lines to your vimrc file | |
if !empty(glob("src")) | |
let $GOPATH=getcwd() | |
let $GOBIN=getcwd() . "/bin" | |
let $PATH=$GOBIN . ":" . $PATH | |
endif |
OlderNewer