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 parseQuery(){ | |
return location.search ? (function(query){ | |
var ret = {}; | |
query.split("&").forEach(function(kv){ | |
var pair = kv.split("="); | |
ret[pair[0]] = pair[1] | |
}); | |
return ret; | |
})(location.search.slice(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
function cheatKeyMap(str,cb){ | |
var cheat_train = str.split(""); | |
var match_offset; | |
var keymap = { | |
38:"上", | |
40:"下", | |
37:"左", | |
39:"右" | |
}; |
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 Queue(tasks,alldone){ | |
var currentTask = tasks[0]; | |
Queue.result = Queue.result || []; | |
function done(result){ | |
Queue.result.push(result); | |
tasks.shift(); | |
Queue(tasks,alldone); | |
} | |
if(tasks.length){ | |
currentTask(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
$url = "http://ditu.google.cn/staticmap?hl=zh-cn¢er=31.226659999958,121.48024000013&zoom=16&size=238x240&markers=31.226659999958,121.48024000013,red&client=free-dianping&signature=fN8tyLxLQ33hLYtFASuB2Wery7Q="; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HEADER, true); | |
$data = curl_exec($ch); | |
$contentLength = 'unknown'; |
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
#from https://github.com/genintho/Git-Pre-Commit | |
#!/bin/sh | |
GOOGLE_CLOSURE_PATH='/svn/staging/jsCompiler.jar' | |
echo "$(tput bold)SUMMARY$(tput sgr0)" | |
git diff --cached --name-status | |
echo '' | |
echo "$(tput bold)STAT$(tput sgr0)" | |
git diff --cached --stat |
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 list = [{ | |
time:1000, | |
proc:function(){ | |
console.log("after 1 second"); | |
} | |
},{ | |
time:5000, | |
proc:function(){ | |
console.log("after 5 seconds"); | |
} |
NewerOlder