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
{ | |
"vue-components": { | |
"prefix": "vue-components", | |
"body": [ | |
"<template>\r", | |
"\r", | |
"</template>\r", | |
"<script>\r", | |
"export default {\r", | |
" name: '$1',\r", |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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
/** | |
* 防止函数过多的执行,默认十秒钟 | |
* @param {any} func 待修改的函数 | |
* @param {number} [wait=10000] 等待时间 | |
*/ | |
function debounce(func, wait = 10000) { | |
let lastTime = ''; | |
return (...argv) => { | |
let thisTime = new Date(); | |
if (!lastTime || thisTime - lastTime > wait) { |
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
/** | |
* 过滤特殊的字符 | |
* @param {any} 需要被过滤掉字符串 | |
* @returns 过滤后的结果 | |
*/ | |
function deepFilter(src) { | |
let dst, prop; | |
let type = Object.prototype.toString.call(src); | |
if (type === '[object Array]') { | |
dst = []; |
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
{ | |
"name": "John", | |
"age": 18, | |
"gender": "male", | |
"weight": "75kg" | |
} |
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
FROM alpine:3.5 | |
MAINTAINER NGINX Docker Maintainers "[email protected]" | |
ENV NGINX_VERSION 1.12.0 | |
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ | |
&& CONFIG="\ | |
--prefix=/etc/nginx \ | |
--sbin-path=/usr/sbin/nginx \ |
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
const pipeline = (...args) => args.reduce((l, r) => r(l)); |
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 compress(img) { | |
var initSize = img.src.length; | |
var width = img.width; | |
var height = img.height; | |
//如果图片大于四百万像素,计算压缩比并将大小压至400万以下 | |
var ratio; | |
if ((ratio = width * height / 4000000)>1) { | |
ratio = Math.sqrt(ratio); | |
width /= ratio; |
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
<html> | |
<body> | |
<div id="test-image-preview" style="border: 1px solid rgb(204, 204, 204); width: 100%; height: 200px; background-size: contain; background-repeat: no-repeat; background-position: center center;"> | |
</div> | |
<br/> | |
<div id="test-file-info"></div> | |
<br/> | |
<input type="file" id="test-image-file"> | |
<script type="text/javascript"> |
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 deepEqual = function (x, y) { | |
if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) { | |
if (Object.keys(x).length != Object.keys(y).length) { | |
return false; | |
} | |
for (var prop in x) { | |
if (y.hasOwnProperty(prop)) { | |
return deepEqual(x[prop], y[prop]); | |
} | |
} |