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
/** | |
* 时间差计算 | |
* | |
* @param Timestamp $time 时间差 | |
* @return String Time Elapsed | |
* @author Shelley Shyan | |
* @copyright http://phparch.cn (Professional PHP Architecture) | |
*/ | |
function time2Units ($time) | |
{ |
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 | |
/** | |
* 用法:复制以下代码至新建的php文件中,将该php文件放置项目目录,运行即可。代码来源于网络。 | |
* chenwei 注。 | |
*/ | |
header('content-Type: text/html; charset=utf-8'); | |
$auto=0;/* 设置为1标示检测BOM并去除,设置为0标示只进行BOM检测,不去除 */ | |
$basedir='.'; | |
$loop=true; | |
echo '当前查找的目录为:'.$basedir.'当前的设置是:'; |
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
# add following lines to your vimrc file | |
if !empty(glob("src")) | |
let $GOPATH=getcwd() | |
let $GOBIN=getcwd() . "/bin" | |
let $PATH=$GOBIN . ":" . $PATH | |
endif |
OlderNewer