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 less = require('gulp-less'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var LessPluginCleanCSS = require("less-plugin-clean-css"), | |
cleancss = new LessPluginCleanCSS({advanced: true}); | |
var LessPluginAutoPrefix = require('less-plugin-autoprefix'), | |
autoprefix = new LessPluginAutoPrefix({browsers: ["last 2 versions"]}); | |
gulp.task('default', function () { | |
gulp.src('./less/project.less') |
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 charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<!--Time found that if you used display:none on the parent of the element you want to hide, the bg image will not be downloaded--> | |
<div style="display: none"> | |
<div style="background-image: url(https://avatars0.githubusercontent.com/u/6081537?v=3&s=40)"></div> |
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 charset="UTF-8"> | |
<title></title> | |
<style> | |
* { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; |
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
.idea | |
node_modules | |
dist | |
bower_components | |
.DS_Store | |
doc |
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
.idea | |
node_modules | |
dist | |
bower_components | |
.DS_Store | |
doc |
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); |
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
/** | |
* | |
* 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
// 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
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); |