GithubHelp home page GithubHelp logo

coding's People

coding's Issues

git学习

常用命令:

初始化
git init 
跟踪
git add
提交
git commit 
查看状态
git status

今天?to do!!!

这个issues记录,当天想(要)做什么,一天过后又完成了哪些。
不定时更新,坚持···

eslint es6

"parser": "babel-eslint",

npm install babel-eslint --save-dev

wx-eslint.sh

#! /usr/bin/env sh

PASS=true
echo "\nValidating Javascript:\n"

git diff --cached --name-only | grep -E '*.js$' | xargs eslint --fix
if [[  $? -eq 0 ]]; then
    echo "ESLint Passed"    
    else
    echo "ESLint Failed"
    PASS=false
fi
echo "\nJavascript validation completed!\n"
if ! $PASS; then
  echo "COMMIT FAILED: Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
  exit 1
fi
exit $?

缓存

前端缓存主要是分为HTTP缓存和浏览器缓存

image

强缓存与协商缓存区别:

image

代码tips

微信小程序

onLoad(options){ },
参数都为options.

浅拷贝和深拷贝

对原始对象(string,number,boolean)的拷贝都是,生成与原始数据相同的新的数据。
而引用对象(array,object),有两种。一浅拷贝,与被拷贝的指向一份数据(有数据变动时,两份数据都改变)。另一种深拷贝,生成的是跟被拷贝的一样的数据,两分数据独立,不会相互影响。

git 命令行

常用的

  • ls
    查看列表

  • cd ..
    返回上一层

  • rm -rf filename
    删除文件

JS对象到字符串,对象到数字的转换细节

对象到字符串的转换:

首先调用toString方法,只有当toString不返回一个原始值的时候,才会调用valueOf()。toString方法但是基本上所有对象都返回字符串。所以对象到字符串形式的转换基本都是使用toString方法。
俩个方法都不返回原始值时,会抛出错误。

对象到数字的转换过程

首先调用的valueOf(),返回的是对象本身。valueOf,基本上所有的对象返回的都是对象,虽然先使用valueOf,但是实际上也是使用的toString的方法。

玉佩家帮

主账号:18457971688
密码:12345678

  • 商城名称改为(玉佩帮手),改logo

Node.js学习

新开一课。
目标:入门,上手练习,打打打打打打···

jd unfollow shop

const timeout = (t = 1) => new Promise((resolve, reject) => setTimeout(resolve,t*1000));

let i = 5;
while(i--){
document.querySelector('html').scrollTop = 0xffffff;
await timeout(1);
}

const go = async () =>{
await timeout(2);
await document.getElementsByClassName('btn-def batch-btn')[0].click();
await timeout(2);
await document.getElementsByClassName('op-btn u-check')[0].click();
await timeout(2);
await document.getElementsByClassName('op-btn u-unfollow')[0].click();
await timeout(2);
await document.getElementsByClassName('ui-dialog-btn-submit')[0].click();
await timeout(2);
await go();
}

go()

网络的小知识

玩游戏为什么会出现卡顿?由此引申的网络知识

网络带宽,车道的宽度

网络速度,网络速率/8。上行速率<<下行速率。
200M宽带,其极限下载速度为 204800k/8=25600k字节/秒(Mbps) =25M/s 。

网络延迟(出现卡顿的原因),影响网络延迟的主要因素是目标服务器之间的节点数、节点性能和各节点之间的距离。

1、如果自己的宽带很低的话,第一步肯定是提升宽带。100M和200M的用户来说,区别不大。但是,如果是5M和50M之间可能还是有区别的。
2、换运营商或者换区。有些游戏有电信区、联通区,那么尽量选择和自己的网络供应商相同的区来玩,这样可以大大减少网络延迟。
3、使用加速器。游戏加速器的原理是通过选择新的网络节点,绕过原来的延迟较高的节点,以此达到游戏延迟降低的效果。

JS运算符

严格比较运算符(===)和转换类型比较运算符(==)--[比较操作符

](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)

(===),仅当两个操作数的类型相同且值相等为 true
(==),会在进行比较之前,将两个操作数转换成相同的类型。

对于关系运算符(比如 <=)来说,会先将操作数转为原始值,使它们类型相同,再进行比较运算。

注意: 字符串对象的类型是对象,不是字符串!
var a = new String('foo');
var b = new String('foo');
a == b               // false 

bash

initLogFolder.sh

#!/bin/bash

PARENT_PATH=./storage/logs/
rm -rf $PARENT_PATH*
for x in closeWeChatOrder orderAutomaticBalance orderConfirmReceipt rechargeOrder statisticsProductData couponInvalidDelete orderAutomaticFinish productStatusUpdate statisticsMallDailyData statisticsShopDailyData works orderAutomaticSmokeCommission product_status_update statisticsMallData statisticsShopData
do
    mkdir $PARENT_PATH$x
done

chmod -R 777 ./storage

小程序登录过期

在给小程序重新设置接口以后,重新编译后,还是一直报错,登录过期。

JS基础-Math&&Date

圆周率
Math.PI
3.141592653589793

需要注意的是很多数学函数都有一个精度,并且精度在不同环境下也是不相同的。这就意味着不同的浏览器会给出不同的结果,甚至相同的 JS 引擎在不同的OS或者架构下也会给出不同的结果。

向上取整(天花板)
Math.ceil(5.5)          //6
Math.ceil(-5.5)          //-5

返回小于x的最大整数;向下取整(地板)
Math.floor(5.5)          //5
Math.floor(-5.5)          //-6

返回四舍五入后的整数
Math.round(5.5)          //6
Math.round(-5.5)          //-5

绝对值
Math.abs(5.5)          //5.5
Math.abs(-5.5)          //5.5

返回给定的一组数字中的最大值
Math.max(10, 20, 30);       //30
返回给定的一组数字中的最小值
Math.min(10, 20, 30);       //10

返回0到1之间的伪随机数
Math.random()          //0.6042687145432997
Math.random()          //0.1542841581058476

实验性:

返回x的符号函数, 判定x是正数,负数,还是0.
Math.sign(5.5)          //1
Math.sign(-5.5)         //-1
Math.sign(0)            //0
Math.sign(-0)            //-0

返回x的整数部分,去除小数
Math.trunc(5.5)           //5
Math.trunc(-5.5)           //-5

sock5tohttp

搞个命令每次执行前导出环境变量

https_proxy=socks5://127.0.0.1:1086 
http_proxy=socks5://127.0.0.1:1086

就可以了

vue基础--查漏补缺

计算属性:
计算属性是基于它们的依赖进行缓存的。
只在相关依赖发生改变时它们才会重新求值。这就意味着只要 message 还没有发生改变,多次访问 reversedMessage 计算属性会立即返回之前的计算结果,而不必再次执行函数。

 reversedMessage: function () {
      // `this` 指向 vm 实例
      return this.message.split('').reverse().join('')
    }
这也同样意味着下面的计算属性将不再更新,因为 Date.now() 不是响应式依赖:
computed: {
  now: function () {
    return Date.now()
  }
}
可以通过在表达式中调用方法,每当触发重新渲染时,调用方法将总会再次执行函数

methods: {
  now: function () {
    return Date.now()
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.