This file contains hidden or 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(exports) { | |
var defaults = { | |
sep: '&', | |
eq: '=', | |
// 把querystring中的值仅按字符串解析 | |
// 值为true时,如arr=[1,2] -> {"arr": "[1,2]"} | |
beString: false | |
}; | |
var querystring = { | |
// 'str="aaa"&bool&num=123&arr=[1,2]&obj={"foo":1}' |
This file contains hidden or 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 optionalParam = /\((.*?)\)/g; | |
var namedParam = /(\(\?)?(:\w+)(?:\\\[([^\]]+)\\\])?/g; | |
var itemParam = /:(\w+)(\?)?(?:\[([^\]]+)\])?/g; | |
var splatParam = /\*/g; | |
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; | |
/** | |
* 路由规则转为正则表达式 | |
* |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta charset="utf-8"> | |
<style> | |
body{background-color:#f4f4f4;color:#555;width:80%;padding:20px;font-size:16px;font-weight:200;margin:0 auto;font-family:Helvetica Neue,arial,verdana}h1{color:#708090;text-shadow:0 1px 2px #fff;font-size:4em;text-align:center}.subtitle{text-align:center;margin-bottom:60px}h2{text-shadow:0 1px 2px #fff}h2 span{font-weight:200;font-size:14px}a{color:#a80000}.smaller{font-size:.8em}h4{margin:4px 0;font-weight:400;font-size:20px}textarea{font-family: Arial;border:1px solid lightgrey;outline:none;font-size:14px;width:96%;height:310px;font-size: 20px;padding:10px;text-align:left}.templategroup,.datagroup,.functiongroup,.resultgroup{width:48%;margin:4px 2% 4px 0;float:left;min-width:300px;}.function,.result{background:#DDD;height:312px;font-size: 20px;padding:10px;font-size:14px;overflow-y:auto}.definegroup{display:none}.templategroup.withdefs .definegroup{display:block}.temp |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Odin</title> | |
<link href="style.css" rel="stylesheet"> | |
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> | |
<script src="slide.js"></script> | |
<script> | |
$(function(){ |
This file contains hidden or 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 uuid() { | |
return (Math.random()).toString(36).slice(2, 7); | |
} |
This file contains hidden or 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() { | |
var cache = {}; | |
this.tmpl = function(str, data) { | |
cache[str] = cache[str] || | |
new Function('data', [ | |
'var _p="";\nwith(arguments[0]||{}){\n_p+="', | |
str.replace(/"/g, '\\$&') | |
.replace(/[\r\n]/g, '') | |
.replace(/<%([^\w\s\}\)]*)\s*(.*?)\s*%>/g, function(match, mark, code) { | |
if (mark === '=') return '"+(' + code + ')+"'; |
This file contains hidden or 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 exec = require('child_process').exec, | |
path = require('path'); | |
var TianmaCmd = function(tianma, cwd) { | |
this.tianma = tianma || path.join(__dirname, '../node_modules/tianma/bin/tianma'); | |
this.cwd = cwd || path.join(__dirname, '../node_modules/tianma/deploy'); | |
}; | |
TianmaCmd.prototype = { | |
_exec: function(cmd, callback) { |
This file contains hidden or 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
<html> | |
<head> | |
<title>tianmaGUI</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
document.write('node version:' + process.version); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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 fs = require('fs'), | |
path = require('path'), | |
TianmaCmd = require('./tianma-cmd'), | |
doc = window.document, | |
workdir = doc.getElementById('workdir'), | |
tianma = TianmaCmd(); | |
workdir.addEventListener('change', function(evt) { | |
var dir = this.value, | |
configArr = []; |
This file contains hidden or 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 crypto = require('crypto'); | |
function md5 (text) { | |
return crypto.createHash('md5').update(text).digest('hex'); | |
}; |