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 path | |
* @return {String|XML} | |
*/ | |
getRealPath: function (path) { | |
var DOT_RE = /\/\.\//g, | |
DOUBLE_DOT_RE = /\/[^\/]+\/\.\.\//; | |
// /a/b/./c/./d ==> /a/b/c/d |
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
// more on: http://jsperf.com/js-shuffle-test/2 | |
/** | |
* 数组洗牌算法 | |
* @param arr | |
*/ | |
function shuffle(arr) { | |
var s = []; | |
while (arr.length) s.push(arr.splice(Math.random() * arr.length, 1)[0]); | |
arr = arr.concat(s); |
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
input { | |
border: none; | |
border-bottom: 1px solid #01a34b; | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#01a34b), color-stop(80%, #fff), color-stop(81%, #01a34b), color-stop(100%, #01a34b)),-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#01a34b), color-stop(80%, #fff), color-stop(81%, #01a34b), color-stop(100%, #01a34b)); | |
background-size: 1px 100%; | |
background-position: 0 0, 100% 0; | |
background-repeat: no-repeat; | |
} | |
input:focus, |
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
*{margin:0;padding:0;} | |
.grid { | |
padding: 600px 0; | |
background-repeat: repeat-y; | |
background-size: 1px auto; | |
} | |
@media screen and (max-width:480px) { | |
.grid { | |
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ccc), to(#ccc)), -webkit-gradient(linear, 0 0, 0 100%, from(#ccc), to(#ccc)); | |
background-position:33% 0,66% 0; |
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
#!/bin/bash | |
RCol='\033[0m' # Text Reset | |
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds | |
Bla='\033[0;30m'; BBla='\033[1;30m'; UBla='\033[4;30m'; IBla='\033[0;90m'; BIBla='\033[1;90m'; On_Bla='\033[40m'; On_IBla='\033[0;100m'; | |
Red='\033[0;31m'; BRed='\033[1;31m'; URed='\033[4;31m'; IRed='\033[0;91m'; BIRed='\033[1;91m'; On_Red='\033[41m'; On_IRed='\033[0;101m'; | |
Gre='\033[0;32m'; BGre='\033[1;32m'; UGre='\033[4;32m'; IGre='\033[0;92m'; BIGre='\033[1;92m'; On_Gre='\033[42m'; On_IGre='\033[0;102m'; | |
Yel='\033[0;33m'; BYel='\033[1;33m'; UYel='\033[4;33m'; IYel='\033[0;93m'; BIYel='\033[1;93m'; On_Yel='\033[43m'; On_IYel='\033[0;103m'; | |
Blu='\033[0;34m'; BBlu='\033[1;34m'; UBlu='\033[4;34m'; IBlu='\033[0;94m'; BIBlu='\033[1;94m'; On_Blu='\033[44m'; On_IBlu='\033[0;104m'; |
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
javascript:;(function() { var dates=[];document.querySelectorAll('html /deep/ .com-panel').array().forEach(function(item){var date=item.querySelector('.com-t-day').innerText;if(date.indexOf('/')!=-1)return;item=item.querySelector('.com-f-time');var endTime=item.children[1].innerText;endTime=endTime&&parseInt(endTime.split(":")[0]);if(endTime>=20||(endTime<6&&endTime>0)){dates.push(date);item.style.webkitBoxShadow="0 0 3px 3px red"}});console.log(dates.join(','),"共"+dates.length+"天,"+(dates.length*18)+"元") })() |
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 winston = require('winston'); | |
var fs = require('fs'); | |
var dateUtil = require('date-utils'); | |
var LOGPATH = './log/'; | |
var DOMAIN = 'www.labi.com'; | |
// 测试用对日志文件的切割,所以`maxsize`设的很小 | |
var MAXSIZE = 100; | |
var latest_ex_filename = null; |
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
// 题目: | |
// 假设有字符串 'i am a programmer' | |
// 实现方法全部颠倒,转成 'remmargorp a ma i' | |
var str = 'i am a programmer'; | |
// 函数式递归调用方法实现 | |
function reverseStrByChar(str) { | |
if (!str || Object.prototype.toString.call(str).toLowerCase().indexOf('string') < 0) { | |
throw new Error('reverseStrByChar: Invalid argument ' + str); |
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 times = 0; | |
// 快速排序算法 | |
function quickSort(arr) { | |
if (!arr || Object.prototype.toString.call(arr).toLowerCase().indexOf('array') < 0) { | |
throw new Error('quickSort(): First arguments must be an Array.'); | |
} | |
if (arr.length <= 1) { | |
return arr; | |
} |
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 a() { | |
// some operations | |
} // #1: 到这里会报错吗? | |
*/ | |
// a(); // #2: 到这里会报错吗? |
OlderNewer