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
Statistics.query(paramForCash, function(result){ | |
if (result.length) { | |
$scope.cash = { | |
cash: (result[0].value.cash/100).toFixed(2), | |
weixin: (result[0].value.weixin/100).toFixed(2) | |
}; | |
} | |
}); |
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 lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<script src="jquery.min.js"></script> | |
<script> |
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 request = require("request"); | |
var fs = require("fs"); | |
var cheerio = require('cheerio'); | |
var url = ''; | |
request(url, function (err, res, body) { | |
if (err) { | |
return console.log(err); | |
} |
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 getTime() { | |
var date = new Date(); | |
var year = date.getFullYear(); | |
var month = (date.getMonth() + 1); | |
month = (month < 9) ? '0' + month : month; | |
var day = date.getDate(); | |
day = (day < 9) ? '0' + day : day; | |
var hour = date.getHours(); | |
hour = (hour < 9) ? '0' + hour : hour; |
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 animation() { | |
var timeArr = (function () { | |
var speeds = [100]; | |
for (var i = 200; i < 1500; i+=100) { | |
speeds.push(i); | |
} | |
return speeds; | |
})(); | |
var animationsArr = [ | |
'zoom-right', |
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 gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var express = require('express'); | |
var path = require('path'); | |
var tinylr = require('tiny-lr'); | |
var createServers = function(port, lrport) { | |
var lr = tinylr(); | |
lr.listen(lrport, function() { | |
gutil.log('LR Listening on', lrport); |
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
// 1. 使用内置的随机数发生方法 | |
Math.random(); // 该方法产生一个0到1之间的浮点数 | |
Math.floor(Math.random() * 10 + 1); // 1-10 | |
Math.floor(Math.random() * 24); // 0-23 | |
// 2. 基于时间,亦可以产生随机数 | |
var now = new Date(); | |
var number = now.getSeconds(); // 这将产生一个基于目前时间的0到59的整数 | |
var now = new Date(); |
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
/** | |
* | |
* Created by tommytang on 5/18/15. | |
*/ | |
var express = require("express"); | |
var http = require("http"); | |
var app = express(); | |
var server = http.createServer(app); |
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
├── app.js | |
├── package.json | |
├── views | |
└── *.jade | |
├── routes | |
└── *.js | |
├── models | |
└── *.js | |
├── config |
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
app.get('/download', function (req, res) { | |
var param = req.query['filename']; | |
if (!param) { return res.sendStatus(401);} | |
var file = __dirname + '/public/' + req.query['filename']; | |
if (!fs.existsSync(file)) {return res.sendStatus(404);} | |
var filename = path.basename(file); | |
var mimetype = mime.lookup(file); | |
res.setHeader('Content-disposition', 'attachment; filename=' + filename); | |
res.setHeader('Content-type', mimetype); |
OlderNewer