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
/** | |
* 计算目标月份的日历,返回按星期组合的二维数组 | |
* @param year | |
* @param month | |
* @returns {Array|*} | |
*/ | |
function getDays(year, month) { | |
// 目标月份第一天 | |
let firstDay = moment(`${year}-${month}`, 'YYYY-MM').startOf('month'); |
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
// ExpressJS调用方式 | |
var express = require('express'); | |
var app = express(); | |
// 引入NodeJS的子进程模块 | |
var child_process = require('child_process'); | |
app.get('/', function(req, res){ | |
// 完整URL |
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
// iPhone4 WeChat WebView | |
@media screen and (max-height:416px){ | |
} | |
// iPhone5 WeChat WebView | |
@media screen | |
and (min-height: 417px) | |
and (max-height: 504px){ | |
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 casper = require('casper').create(); | |
casper.start('http://wj.qq.com/survey.html?type=survey&id=124133&hash=257b'); | |
casper.waitForResource('/image/end.png', function(){ | |
this.echo(this.getHTML()); | |
}); | |
casper.run(); |
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
/** | |
* 页面中全部img都onload后执行 | |
* @param callback | |
* @param opts.timeout 超时执行 | |
*/ | |
function imgAllLoadCall(callback, opts) { | |
var imagesCount = 0; // 待加载img计数 | |
var successCount = 0; // 已加载img计数 | |
var images = document.images; // document中所有img的数组集合 |
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
http://hi.baidu.com/zhmsong/blog/item/7cb17eeaddca8adad539c977.html | |
:s/XXX/YYY/g | |
其中XXX是需要替换的字符串,YYY是替换后的字符串 | |
以上这句只对当前行进行替换,如果需要进行全局替换,则要: | |
%s/XXX/YYY/g | |
如果需要对指定部分进行替换,可以用V进入visual模式,再进行 | |
:s/XXX/YYY/g | |
或者可以指定行数对指定范围进行替换: |
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
/** | |
* XHR2特性,使得ajax可以上传文件 | |
**/ | |
post_image: function(file, success){ | |
if(!file){ | |
return false; | |
} | |
var url = server + 'post_image'; |
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
/** | |
* Created by libo on 15/2/12. | |
* 依赖: framework7 和 PushPlugin | |
*/ | |
/*global define, console*/ | |
define(function (require, exports, modules) { | |
'use strict'; | |
require('lib/PushNotification'); | |
var Framework7 = require('framework7'); |
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
/** | |
* jQuery Transform & Transition Shortcuts | |
* | |
* 从Framework7中的DOM7剥离重构一些有用的片段 | |
*/ | |
;(function(){ | |
// 变换 | |
$.fn.transform = function(transform){ |
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
location / { | |
if (!-e $request_filename){ | |
rewrite ^(.*) /index.php?s=$1 last; | |
break; | |
} | |
} |
NewerOlder