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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>mysql query result to json</title> | |
<style> | |
.mysql-query-result-input, .mysql-query-result-input-wrap { | |
width: 600px; |
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
// sequelize config | |
var sequelize = new sequelize('database', 'user', 'pass', { | |
host: '127.0.0.1', | |
dialect: 'mysql', | |
port: 3306, | |
pool: { | |
max: 10, | |
min: 0, | |
idle: 20000 |
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 isSupportWebp() { | |
return !![].map && document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') == 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
let isFunction = function (obj) { | |
return typeof obj === 'function' || false; | |
}; | |
class EventEmitter { | |
constructor() { | |
this.listeners = new Map(); | |
} | |
on(label, callback) { | |
this.listeners.has(label) || this.listeners.set(label, []); |
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
#textarea { | |
display: block; | |
margin:0 auto; | |
overflow: hidden; | |
width: 550px; | |
font-size: 14px; | |
height: 18px; | |
line-height: 24px; | |
padding:2px; | |
} |
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
//简易dos文件格式转unix | |
module.exports = function(str){ | |
return str.replace(/(?:\r(\n)|\^M$|\x0D$)/g, '$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
module.exports = function(str){ | |
return "module.exports = '" | |
+ str | |
.replace(/'/g, "\\'") | |
.replace(/\r\n|\r|\n/g, "\\n") | |
+ "';"; | |
}; |
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
//移动设备设置rem, 参考m.taobao.com | |
;function (window) { | |
var v = window.devicePixelRatio; | |
var dpr = v ? (v >= 3 ? 3 : (v >= 2 ? 2 : 1)) : 1; | |
var scale = 1 / dpr; | |
var doc = window.document; | |
var html = doc.documentElement; | |
var viewport = doc.createElement('meta'); | |
viewport.setAttribute('name', 'viewport'); |