Skip to content

Instantly share code, notes, and snippets.

View wplnancy's full-sized avatar

wplnancy wplnancy

View GitHub Profile
@wplnancy
wplnancy / ajaxFilter.js
Last active March 5, 2018 00:56
拦截发送重复的 ajax 请求
!function(){
var ajaxPreFilter = function (funs) {
window.soucexhr = window.soucexhr || window.XMLHttpRequest;
window.pendingRequestUrl = {};
window.pendingData = {};
window.xhrTime = {};
@wplnancy
wplnancy / isObjectValueEqual.js
Created March 5, 2018 00:49
// 判断两个对象的值是否相等
// 判断两个对象的值是否相等
function isObjectValueEqual(a, b) {
var aProps = Object.getOwnPropertyNames(a);
var bProps = Object.getOwnPropertyNames(b);
if (aProps.length != bProps.length) {
return false;
}
for (var i = 0; i < aProps.length; i++) {
@wplnancy
wplnancy / index.js
Created February 27, 2018 05:18
查找网站中的中文正则
re = /^ ([\u4e00-\u9fa5|( |,。、;:!?<br>¥《》()\w\.)*)]+)/gi
str = ' 如果有人对《授权书》及V.Fine平台,V.Fine会出示更多音乐人授权证明,帮助客户维权。'
console.log str.match re
console.log RegExp.$1
@wplnancy
wplnancy / jihuo.txt
Created February 27, 2018 02:49
sublime text3 激活码
—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
D5D52613 C3D12E98 BC49967F 7652EED2
@wplnancy
wplnancy / index.coffee
Created February 24, 2018 02:43
导出 i18n 翻译对照表
fs = require 'fs'
xlsx = require 'better-xlsx'
file = new xlsx.File
sheet = file.addSheet '翻译对照表'
en = require './en'
cn = require './cn'
data = []
for key, value of cn
data.push [key, value, en[key]]
@wplnancy
wplnancy / getFileList.js
Created August 16, 2017 02:20
读取文件的内容
fs = require 'fs'
path = require 'path'
module.exports = (paths, extname) ->
allFiles = []
getFile = (dirPath) ->
try
if (path.extname dirPath) is ".#{extname}"
allFiles.push dirPath
else if do (fs.statSync dirPath).isDirectory
for p in fs.readdirSync dirPath
@wplnancy
wplnancy / main.css
Created August 15, 2017 08:44
处理移动端1像素问题的缩放解决方案
.border-1px{
position: relative;
}
.border-1px::after {
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
@wplnancy
wplnancy / index.js
Created July 13, 2017 07:47
添加前置0操作
function padZeros(str, len) {
if (str.length < len) {
let toAdd = len - str.length;
while (toAdd) {
str = '0' + str;
toAdd--;
}
}
return str;
}
@wplnancy
wplnancy / popover
Created July 13, 2017 03:44
二维码的弹框实现方式二
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
@wplnancy
wplnancy / popover
Created July 13, 2017 03:38
一个二维码的弹框的三角的实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}