- 要实现的目标和要解决的问题;
- 要达到的结果,宽松和严格时间节点?
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
" Search Dash for word under cursor | |
function! SearchDash() | |
let s:browser = "/usr/bin/open" | |
let s:wordUnderCursor = expand("<cword>") | |
let s:url = "dash://".s:wordUnderCursor | |
let s:cmd ="silent ! " . s:browser . " " . s:url | |
execute s:cmd | |
redraw! | |
endfunction | |
map <leader>d :call SearchDash()<CR> |
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
" Searches Dash for the word under your cursor in vim, using the keyword | |
" operator, based on file type. E.g. for JavaScript files, I have it | |
" configured to search j:term, which immediately brings up the JS doc | |
" for that keyword. Might need some customisation for your own keywords! | |
function! SearchDash() | |
" Some setup | |
let s:browser = "/usr/bin/open" | |
let s:wordUnderCursor = expand("<cword>") |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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 PrimeGenerator = function() { | |
// 初始化的素数 | |
this.prime = 1; | |
// 判断是否是素数 | |
this.isPrime = function(num) { | |
var result = true; | |
if (num !== 2) { | |
if (num % 2 == 0) { | |
result = false; |
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
function minimum(a,b,c) { | |
var min = a; | |
if (b<min) { | |
min = b; | |
} | |
if (c<min) { | |
min = c; | |
} |
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 | |
# build trust relations between linux hosts | |
user="wangshijun" | |
machine="hostname1 hostname2 hostname3" | |
for i in $machine | |
do | |
scp ~/.ssh/id_rsa.pub ${user}@$i:./ | |
ssh ${user}@$i 'cat id_rsa.pub >>.ssh/authorized_keys; chmod 700 .ssh;chmod 600 .ssh/authorized_keys' | |
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
#!/bin/bash | |
TMP_DIR="output" | |
PRODUCT_DIR="project-production" | |
IGNORE_FILE="$TMP_DIR build.sh tests" | |
OUTPUT_FILE="project-production.tar.gz" | |
# prepare tmp dir | |
mkdir -p $TMP_DIR | |
rm -rf $TMP_DIR/* |
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 | |
/** | |
* Log Queue, maitains log entries that laies within the specified time peroid | |
* | |
* @author wangshijun <wangshijun2010@baidu.com> | |
* @copyright wangshijun2010@gmail.com | |
* @package Log | |
* @subpackage LogQueue | |
* @todo Feature: on_queue_ready callback called internally | |
*/ |
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 | |
function get_client_ip() { | |
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { | |
if(isset($_SERVER["HTTP_CLIENT_IP"])) { | |
return $_SERVER["HTTP_CLIENT_IP"]; | |
} else { | |
return $_SERVER["REMOTE_ADDR"]; | |
} | |
return $_SERVER["HTTP_X_FORWARDED_FOR"]; |