Skip to content

Instantly share code, notes, and snippets.

View jumplee's full-sized avatar
🤩

lee jumplee

🤩
View GitHub Profile
var getRandomColor = function () {
var str = '#'
for (var i = 0; i < 6; i++) {
str += '0123456789abcdef' [Math.floor(Math.random() * 16)]
}
return str
}
Array.prototype.last = function () {
return this[this.length - 1]
}
@jumplee
jumplee / .eslintrc.js
Created October 13, 2017 01:48
vue项目的js样式标准
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
extends: 'vue',
#!/bin/bash
# author: koumm
# desc: auto vsftpd script
# date: 2010-07-30
# version: v1.1
# modify:
WEBROOT="/data1/htdocs/www.koumm.com"
FTP_PORT="3000"
@jumplee
jumplee / gist:8e615e46afa95a24d0e094f72fc66d8d
Created April 20, 2018 11:23 — forked from binjoo/gist:3926896
JAVASCRIPT:解决JS浮点数(小数)计算加减乘除的BUG
/**
** 加法函数,用来得到精确的加法结果
** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
** 调用:accAdd(arg1,arg2)
** 返回值:arg1加上arg2的精确结果
**/
function accAdd(arg1, arg2) {
var r1, r2, m, c;
try {
r1 = arg1.toString().split(".")[1].length;
@jumplee
jumplee / test.swift
Last active February 1, 2019 03:51
change orientation
test{
func changeOrientation(){
guard let slf = self else {
return
}
let isPortrait=slf.isScreenPortrait()
print("isPortrait===>"+String(isPortrait))
let isPortrait=slf.isScreenPortrait()
print("isPortrait===>"+String(isPortrait))
if isPortrait {
@jumplee
jumplee / clock.js
Last active July 25, 2019 03:29
执行某个函数n次并有一定时间间隔
function clock(func,times,timeout){
if(!timeout||parseInt(timeout)===NaN){
timeout=100;
}
var _counter=0;
function _(){
func();
_counter++;
if(_counter<times){
setTimeout(function(){
@jumplee
jumplee / .gitignore
Created October 4, 2019 03:46
nodejs gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
@jumplee
jumplee / .gitignore
Created October 4, 2019 03:48
前端项目git模版
node_modules/
dist
build
# webstorm
.idea
@jumplee
jumplee / hasOperate.js
Last active November 3, 2019 03:06
屏幕长时间无操作执行相应操作(回到首页等)
/**
* 屏幕长时间无操作执行相应操作(回到首页等)
* @param callback
* @param millisecond
*/
function hasOperate(callback, millisecond) {
var timer;