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
// v2.0,避免一个for (in),速度大幅度提高,但graph的构造不如之前优雅,优化了hash,总代码量几乎没有增加,加了点注释。 | |
var ops = ['+7', '/2', '*3', '-5']; | |
var graph = [ | |
[{e:0,n:1}, {e:1,n:1}], | |
[{e:0,n:0}, {e:1,n:0}, {e:2,n:2}, {e:3,n:2}], | |
[{e:2,n:1}, {e:3,n:1}] | |
]; // 第一维是顶点,第二维是出边,e是边的id,n是指向的顶点。 | |
graph.forEach(function(vex, i){ | |
vex.forEach(function(edge, j){ | |
edge.f = new Function('val', 'return val' + ops[edge.e]); // 把边构造成一个function |
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
ex () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) rar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $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
#pl_leftnav_app, | |
#trustPagelet_checkin_lotteryv5, | |
#trustPagelet_recom_interestv5, | |
.gn_title[node-type=app], | |
.gn_title[node-type=weiba], | |
.gn_title[node-type=game], | |
.gn_title[node-type=hot], | |
.gn_setting[node-type=member], | |
#pl_rightmod_ads35, | |
/*#trustPagelet_zt_hottopicv5,*/ /*右侧导航[热门话题]予以保留,不想看这个的可以把这行注释取消掉*/ |
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
'在Outlook里面,按alt+F11,然后编辑器里搞这个进去 | |
'这样在发送邮件的时候会检测空标题 | |
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) | |
If TypeName(Item) <> "MailItem" Then Exit Sub | |
Dim cancel_Subject As Boolean | |
Dim cancel_Attach As Boolean | |
'CHECK FOR BLANK SUBJECT LINE | |
If Item.Subject = "" Then | |
cancel_Subject = MsgBox("邮件无标题,依然发送吗?", vbYesNo + vbExclamation, "邮件标题为空") = vbNo |
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
<html> | |
<head> | |
<style> | |
#list { | |
} | |
.item { | |
width:15px; | |
height:10px; | |
overflow:hidden; | |
float:left; |
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
<html> | |
<head> | |
<style> | |
#list { | |
} | |
.item { | |
width:15px; | |
height:10px; | |
overflow:hidden; | |
float:left; |
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
<!doctype html> | |
<html> | |
<head> | |
<title>CSS3文字渐变</title> | |
<meta charset="UTF-8"> | |
<style type="text/css"> | |
body { | |
margin:0; | |
padding:0; | |
background:#fff; |
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 DeCasteljauBezier(points, density, step){ | |
//if (points.length < 3) return null; | |
console.time('bezier'); | |
var ps = points.map(function(p){ | |
return { | |
x: p.x, | |
y: p.y | |
}; | |
}), | |
results = [], |
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 hrtime = (function(){ | |
if (typeof window !== 'undefined'){ | |
// browser | |
if (typeof window.performance !== 'undefined' && typeof performance.now !== 'undefined'){ | |
// support hrt | |
return function(){ | |
return performance.now(); | |
}; | |
}else{ | |
// oh no.. |
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
// app.js | |
for (var controller in routes){ | |
var mod = routes[controller]; | |
app.all('/' + controller + ':action', function(req, res){ | |
var action = req.params.action; | |
if (action in mod){ | |
mod[action](req, res); | |
}else{ | |
res.statusCode = 404; | |
res.send('404 not found'); |
OlderNewer