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 {string} path | |
* @return {string} | |
*/ | |
const PATH_START = 0 | |
const PATH_END = 1 | |
const PATH_READ = 2 | |
const PATH_CURRENT = 3 | |
const PATH_PARENT = 4 |
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 insertionSort(arr){ | |
var len = arr.length,index = 0,val | |
for(var j = 1;j < len ; j++){ | |
val = arr[j] | |
index = j - 1; | |
while(index >= 0 && val < arr[index]){ | |
arr[index+1] = arr[index] | |
index = index - 1 | |
} | |
arr[index+1] = val |
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 easings = (function() { | |
var eases = {}; | |
var names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo']; | |
var functions = { | |
Sine: function(t) { return 1 - Math.cos( t * Math.PI / 2 ); }, | |
Circ: function(t) { return 1 - Math.sqrt( 1 - t * t ); }, | |
Elastic: function(t, m) { | |
if( t === 0 || t === 1 ) return t; | |
var p = (1 - Math.min(m, 998) / 1000), st = t / 1, st1 = st - 1, s = p / ( 2 * Math.PI ) * Math.asin( 1 ); | |
return -( Math.pow( 2, 10 * st1 ) * Math.sin( ( st1 - s ) * ( 2 * Math.PI ) / p ) ); |
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 parseUrlParam(url){ | |
var match, | |
urlParams = {}, | |
pl = /\+/g, // Regex for replacing addition symbol with a space | |
search = /([^&=]+)=?([^&]*)/g, | |
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); } | |
var query = url || location.href | |
var qus = query.indexOf('?') | |
if(qus !== -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
.row { | |
box-sizing: border-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-flex: 0 1 auto; | |
-ms-flex: 0 1 auto; | |
flex: 0 1 auto; | |
-webkit-flex-direction: row; | |
-ms-flex-direction: row; |
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 renderParser(string,data){ | |
const S_CODE = 0x24 // start CODE $ | |
const S_LEFT = 0x7b // { | |
const S_RIGHT = 0x7d // } | |
const S_SPACE = 0x20 | |
let length = string.length | |
let at = 0,code,expession = '',expessionResult = '' | |
let isEnterExpression = false | |
let result = '' | |
function charAt(at){ |
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 getUniquePath(element){ | |
if(element.nodeType !== Node.ELEMENT_NODE){ | |
throw new Error('element must be element node') | |
} | |
if(element.id){ | |
return '#' + element.id | |
} | |
var path = '' | |
while(element){ | |
var name = element.localName |
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
const REPLACE_REGEX = /(Y|M|D|H|I|S|T)/ig | |
export function timeFormat(unixTime, format = 'Y-M-D H:i:s') { | |
var time = new Date(unixTime * 1000) | |
var conf = { | |
Y: time.getFullYear(), | |
M: pad(time.getMonth() + 1), //月份 | |
D: pad(time.getDate()), //日 | |
H: pad(time.getHours()), //小时 | |
I: pad(time.getMinutes()), //分 | |
S: pad(time.getSeconds()), //秒 |
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
/** | |
* csv data encode | |
* var data = [[1850, 20, 0, 1, 1017281], [1850, 20, 0, 2, 1003841]]; | |
* encode(data) | |
* encode(data,{ header: ["year", "age", "status", "sex", "population"] }) | |
* encode([{age:xx,name:'xxx'}], {header:true}) | |
* options:{ delimiter:'分隔符',newline:换行符,skip:头部跳过数量,header:Object或者arrat } | |
*/ | |
const CELL_DELIMITERS = [',', ';', '\t', '|', '^'] |
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
<?php | |
/* from : https://github.com/Clarence-pan/unpack-wxapkg */ | |
function unpack_wxapkg($file, $targetDir) | |
{ | |
if (!is_dir($targetDir)){ | |
mkdir($targetDir); | |
} | |
echo "Reading file.\n"; |
OlderNewer