Giter Site home page Giter Site logo

hello-world's Introduction

Hi there 👋

hello-world's People

Contributors

shenchuanhuan avatar

hello-world's Issues

css效果记录

多行省略

.text-overflow {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; // 设置显示行数
    -webkit-box-orient: vertical;
}

#npm 相关

npm 镜像设置命令

// 以淘宝源为例
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist

删除已设置的镜像源

npm config delete registry
npm config delete disturl

npm config edit
//然后找到之前设置时的两行命令行,删除即可

切换npm 镜像源

推荐:nrm

cnpm 的问题

cnpm有个问题:用它下载安装的模块都是以软链形式存在的,本来模块文件就多,再加个软链又多一倍文件,导致有些编辑器和IDE检索目录时非常慢。

npmrc 是 npm runtime config 的意思,可以通过这个文件在命令行环境中为 npm 提供环境变量。

更新npm到最新版本

npm install npm@latest -g

some commondlines about VIM

press ESC jumps to VIM commondline modal, then:
:w ==> save but not quit
:w! ==> force save but not quit
:wq ==> save and quit
:wq! ==>force save and quit
q: ==> not save and quit
:q! ==> not save and force quit
:e! ==> give up all changes and begin with the saved files from last time

如何永久关闭vscode的安全提示

最新版本的vscode 在打开时会提示如下信息


Do you trust the authors of the files in this folder?
Code provides features that may automatically execute files in this folder.

If you don't trust the authors of these files, we recommend to continue in restricted mode as the files may be malicious. See our docs to learn more.
 

如果点击了不信任,之后你会发现好多插件直接都不能显示了,像open in browser等等,那怎么关闭呢,很简单,打开设置,搜索security.workspace.trust.enabled

关闭启用,重新启动vscode即可

数据库遇到的问题集合

mongoose

连接报错:UnhandledPromiseRejectionWarning: Error: Invalid schema, expected "mongodb" or "mongodb+srv"
自己写的连接是:

const mongoose = require('mongoose');
mongoose.connect("localhost/testDatabase", function(err) {
if (err) {
    console.log(err, '连接失败');
} else {
    console.log('连接成功');
}
});

正确的写法是:

const mongoose = require('mongoose');
mongoose.connect("mongodb://localhost/testDatabase", function(err) {
if (err) {
    console.log(err, '连接失败');
} else {
    console.log('连接成功');
}
});
//在url的前面添加mongodb://

#String.prototype.XXX

  • String.prototype.padStart & String.prototype.padEnd
    it's a function to fill a string. It receives two params.
    @params maxLength string's final length
    fillString fill string to make initial string to final string
    @return a new string that you want.
    example:
     let a = 'h';
     let b = a.padEnd(6, 'a')
    console.log(a)   // 'h'
    console.log(b)  // 'haaaaa'     

if the fillString's repeat added to initial string leads the length greater than the maxlength, function will slice unnecessary ones. for example :

   let a = 'h';
  let b = a.padEnd(5, 'abc')
  console.log(a)    // 'h'
  console.log(b)   // 'habca'

#shell

确认默认shell

 echo $SHELL

##设置默认shell 【以zsh为例】

chsh -s $(which zsh)
  • $() 为变量
  • which zsh 输出zsh所在位置
  • 如果zsh不在你允许的shell列表上(/etc/shells),可以这样来做。

#git命令行

git命令

  • 要看远程分支
      git branch -r
  • 查看所有分支【本地和远程】
     git branch -a
  • 删除远程分支 test
       git push origin  :test (已测可行)

       or 

      git branch -r -d origin/branch-name 

     or

    git push origin --delete branchname(非默认分支)

@descript: 相当于推送了一个空分支到远程该分支上。

  • 在本地建立一个分支跟踪远程某分支
     git checkout -b 本地分支 远程分支
     
     git checkout 远程分支名
  • 查看及设置本地分支的跟踪信息
  //可以看到分支追踪的远程分支及最近一次提交commit
   git branch -vv            

  
   //设置分支要追踪的远程分支
   git branch --set-upstream-to=origin/远程分支名 本地分支名

   //上面命令行中的 origin 为远程主机名
  • 推送
      git push <远程主机名> <本地分支名>:<远程分支名>
     
      //如果本地分支与远程分支存在追踪关系且同名,且本地分支只有一个追踪关系,则可以写成:
      git push
      
      - 如果存在追踪关系但不同名,例如本地test分支追踪线上test1分支:
       git push origin HEAD:test1
  
- 查看本地分支对应的远程分支的状态
```javascript
     git remote show origin

tracked 表示远程分支还存在, stale 表示远程分支不存在了

  • 查看哪些远程分支需要清理【即已不存在】
    git remote prune 远程主机名 --dry-runn
  • 清理远程不存在的分支
    git remote prune 远程主机名
  • 合并commit
git reset --soft commit-hash

git add .
git commit -m xxxx
git push -f

// 多账户配置git
https://blog.csdn.net/yuanlaijike/article/details/95650625

  • 更新远程仓库
git remote update
  • 合并远程分支xx到本地当前分支
git rebase origin/xx

//如果有冲突,修改冲突后,执行git add <file-name>标记冲突已解决,最后执行
git rebase --continue
  • 合并指定分支
git checkout branch // 切换到需要合并的目标分支

git cherry-pick commit-id // 需要被合并的源分支commit-id
  • 暂存
git stash 



git stash save '这里可以写暂存的内容备注,以便日后可以从暂存区取出'
  • 取出暂存
git stash pop 



git stash apply

//区别在于pop是直接把暂存的内容推出暂存区,apply是取出,但暂存区还存在该内容

//取出指定内容
git stash pop/apply stash@{index}

代码统计

  • 当前产品js代码量量
    find src/ -name "*.js*" |xargs cat|grep -v ^$|wc -l
  • 当前产品scss代码量量
    find src/ -name "*.scss*" |xargs cat|grep -v ^$|wc -l
  • 某同学当⽉月代码量量统计
    git log --author="XX" --since="2020-05-01" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
  • 特有的⽂文件名或⽬目录名筛选代码量量
    git log --author="xx"--since="2020-03-01"-- pretty=tformat: --numstat | grep src |awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
  • 从某天开始到现在所有同学代码量
    git log --since="2020-06-10" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'

遇到的问题

  • 某个项目在.ssh/下有单独的key,也将公钥添加到了gitlab/github,本地~/.ssh/config也做了配置,但git操作权限不通过。有可能是key没有加入到ssh-agent中。
    可以尝试:
  ssh-add -K ~/.ssh/your_private_key

//-K 选项位于 Apple 的 ssh-add 标准版本中,当您将 ssh 密钥添加到 ssh-agent 时,它会将密码存储在您的密钥链中。

打tag

  • 查看tag,列出所有tag,列出的tag是按字母排序的,和创建时间没关系。
git tag
  • 查看指定版本的tag,git tag -l “v1.4.2.**”
$ git tag -l 'v3.*'
  • 创建轻量级tag:这样创建的tag没有附带其他信息
git tag v1.0

  • 带信息的tag:-m后面带的就是注释信息,这样在日后查看的时候会很有用
git tag -a v1.0 -m 'first version'
  • 删除本地tag
git tag -d v1.0
  • 删除github远端的指定tag
git push origin :refs/tags/v1.0.0
  • 创建一个基于指定tag的分支
git checkout -b test v0.1.0
  • 共享tag
git push origin v1.0
或者
git push --tags // 一次性将本地所有tag推送到服务器
  • 克隆指定分支
git clone -b 指定分支名 git-repository
  • 查看git历史
git log 
git log --summary

-设置远程仓库地址

git remote set-url origin git-repository

markdown

  • 斜体
    我是斜体
    *我是斜体*
  • 加粗
    我是加粗文字
    **我是加粗文字**
  • 划线删除
    我是被划掉的文字
    ~~我是被划掉的文字~~

# img 设置伪类无效

给img标签设置伪类,并不会生效。
对比如下:

<div class='testDiv'></div>
<img class='testImg' />
.testDiv {
    position: relative;
    width: 50px;
    height: 50px;
    background-color: black;
}
.testDiv:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: green;
}
.testImg {
    position: relative;
    left: 100px;
    width: 50px;
    height: 50px;
    background-color: black;
}
.testImg:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: green;
}

杂乱无章的记载

< < < 小于号

> > 大于号

≤ ≤ ≤ 小于等于号
≥ ≥ ≥ 大于等于号

" " " 引号


“ � 左双引号


” � 右双引号


‘ � 做单引号


’ � 右单引号

/****** followings update on 2018/05/31 ******/

回车”(Carriage Return)和“换行”(Line Feed)

符号        ASCII码        意义

\n           10        换行

\r            13        回车CR

在Windows中:

 '\r' 回车,回到当前行的行首,而不会换到下一行,如果接着输出的话,本行以前的内容会被逐一覆盖;

 '\n' 换行,换到当前位置的下一行,而不会回到行首;

  Unix系统里,每行结尾只有“<换行>”,即"\n";Windows系统里面,每行结尾是“<回车><换行>”, 
  即“\r\n”;Mac系统里,每行结尾是“<回车>”,即"\r";。一个直接后果是,Unix/Mac系统下的文件在 
  Windows里打开的话,所有文字会变成一行;而Windows里的文件在Unix/Mac下打开的话,在每行的结 
  尾可能会多出一个^M符号。

原文链接

npm 相关

设置 npm 的源

//设置npm的源为淘宝源
npm config set registry https://registry.npm.taobao.org

#webpack

单个文件打包

webpack ./entry.js bundle.js

如果要编译css文件,需要npm install css-loader style-loader

按照webpack2.0文档初步学习编译的时候,遇到了这样一个问题:

安装好了style-loadercss-loader之后,添加style.css文件,并在entry.js里面添加了 require("!style!css!./style.css");,然后重新执行webpack ./entry.js bundle.js进行编译,报错:
ERROR in ./entry.js
Module not found: Error: Can't resolve 'style' in 'D:\Program Files\Github\test\router'
BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.
You need to specify 'style-loader' instead of 'style',
see https://webpack.js.org/guides/migrating/#automatic-loader-module-name-extension-removed
@ ./entry.js 4:0-33

问题原因:Webpack新版本要求配置module中的loader不能缩写。
require('!style!css!./style.css')中的!style !css分别是两个加载器的缩写
解决方案:
将:require("!style!css!./style.css"); 改成 require("!style-loader!css-loader!./style.css"); 即可。

实时编译【监控

命令:webpack --watch

为编译添加上彩色进度条

命令: webpack --progress --colors

development server

webpack-dev-server
官方解释:

This binds a small express server on localhost:8080 which serves your static assets as well as the bundle (compiled automatically). It automatically updates the browser page when a bundle is recompiled (SockJS). Open http://localhost:8080/webpack-dev-server/bundle in your browser.
sf有关文章:
webpack-dev-server是一个小型的Node.js Express服务器,它使用webpack-dev-middleware来服务于webpack的包,除此自外,它还有一个通过Sock.js来连接到服务器的微型运行时.
个人理解:开始8080端口服务器查看编译后的文件。

---笔记from webpack get start

fata: I don't handle protocol 'http'

we have a new standard for git flow.
my colleague advice that forked the project first then program on my own project, and then finished pull a request to the main project. It will keep a clear way for main project.
I take it.
first I download zip of the project . When opened git bash in cloned project, execute git remote add origin XXX@xxxx[last param] to add origin, I paste last param to git bash. It was wrong. It said I don't handle protocol 'http'. It seems like http should be replace by https. But I wasn't. It's because of the character between origin and http://XXX. after removing the character[just by handle writing these again],and entering a real space, it worked!
I found solution on stackoverflow==>thereanswer.

#echarts配置中最容易犯的错

#记录一些常犯的低级错误。

  1. 写好了配置,但没有图像。为什么勒?因为忘记给节点套上宽度。
    • 注意点: 外层节点必须给具体的宽高,即px,如果设置了百分比,则宽会是整屏,高度也无法撑开。

# webpack 配置学习笔记

entry 入口配置

simple rule: one entry point per HTML page. SPA: one entry point, MPA: multiple entry points.
单页面应用单入口,多页面多入口。
值: string || array || object || (function(){return string || array || obj}())
命名:naming
如果配置的是一个 string || array,命名为main。如果传入的是一个对象,则键名为输入块的名字,键值为对应的入口文件。
动态入口配置:

entry: () => './demo'

or 

entry: () => new Promise((resolve) => resolve(['./demo', './demo2'])

output 出口配置

problems:

有关webpack.config.js中的resolve.alias配置问题:

environment: macOS Sierra, node: 7.6.0
wrong config:

      resolve: {
          alias: {
             Doc: path.resolve(__dirname, 'src/doc')
          }
      }

correct config:

      resolve: {
           alias: {
               doc: path.resolve(__dirname, 'src/doc')
          }
       }

summary: if use upper case, the compiler will warn your that :

WARNING in ./src/Model/request.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/XXX/Documents/dh/entity-lib/node_modules/babel-loader/lib/index.js!/Users/XXX/Documents/dh/entity-lib/src/Model/request.js
    Used by 1 module(s), i. e.
    /Users/XXX/Documents/dh/entity-lib/node_modules/babel-loader/lib/index.js!/Users/XXX/Documents/dh/entity-lib/src/components/calcName.js

and your styles will not resolve.

font-family记录

常用中文转英文的字体

华文细黑:STHeiti Light [STXihei] 
华文黑体:STHeiti 
华文楷体:STKaiti 
华文宋体:STSong 
华文仿宋:STFangsong 
儷黑 Pro:LiHei Pro Medium 
儷宋 Pro:LiSong Pro Light 
標楷體:BiauKai 
蘋果儷中黑:Apple LiGothic Medium 
蘋果儷細宋:Apple LiSung Light 
Windows的一些: 
新細明體:PMingLiU 
細明體:MingLiU 
標楷體:DFKai-SB 
黑体:SimHei 
宋体:SimSun 
新宋体:NSimSun 
仿宋:FangSong 
楷体:KaiTi 
仿宋_GB2312:FangSong_GB2312 
楷体_GB2312:KaiTi_GB2312 
微軟正黑體:Microsoft JhengHei 
微软雅黑体:Microsoft YaHei 

装Office会生出来的一些: 
隶书:LiSu 
幼圆:YouYuan 
华文细黑:STXihei 
华文楷体:STKaiti 
华文宋体:STSong 
华文中宋:STZhongsong 
华文仿宋:STFangsong 
方正舒体:FZShuTi 
方正姚体:FZYaoti 
华文彩云:STCaiyun 
华文琥珀:STHupo 
华文隶书:STLiti 
华文行楷:STXingkai 
华文新魏:STXinwei

ios 系统
默认中文字体是Heiti SC

默认英文字体是Helvetica

默认数字字体是HelveticaNeue

无微软雅黑字体

android 系统
默认中文字体是Droidsansfallback

默认英文和数字字体是Droid Sans

无微软雅黑字体

winphone 系统
默认中文字体是Dengxian(方正等线体)

默认英文和数字字体是Segoe

无微软雅黑字体

#小技能

  1. 让浏览器变成编辑器
    在地址栏输入:
 data:text/html, <html contenteditable>

2.如果愚人节想恶搞一下别人的网站,想时实编辑一下怎么办?

     先打开控制台,接着输入
     document.body.contentEditable = true

待看

数据库命令行集合

mongodb 查看数据库

     db.stats()   //命令
  >>
    {
	"db" : "dang",
	"collections" : 6,
	"objects" : 301374,
	"avgObjSize" : 240.42790685327864,
	"dataSize" : 72458720,
	"storageSize" : 98213888,
	"numExtents" : 23,
	"indexes" : 4,
	"indexSize" : 16474640,
	"fileSize" : 201326592,
	"nsSizeMB" : 16,
	"dataFileVersion" : {
		"major" : 4,
		"minor" : 5
	},
	"extentFreeList" : {
		"num" : 0,
		"totalSize" : 0
	},
	"ok" : 1
   }

# Object

Object.values

The Object.values() method returns an array of a given object's own enumerable property values, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).

some examples from MDN:

var obj = { foo: 'bar', baz: 42 };
console.log(Object.values(obj)); // ['bar', 42]

// array like object
var obj = { 0: 'a', 1: 'b', 2: 'c' };
console.log(Object.values(obj)); // ['a', 'b', 'c']

// array like object with random key ordering
var an_obj = { 100: 'a', 2: 'b', 7: 'c' };
console.log(Object.values(an_obj)); // ['b', 'c', 'a']

// getFoo is property which isn't enumerable
var my_obj = Object.create({}, { getFoo: { value: function() { return this.foo; } } });
my_obj.foo = 'bar';
console.log(Object.values(my_obj)); // ['bar']

// non-object argument will be coerced to an object
console.log(Object.values('foo')); // ['f', 'o', 'o']

Object.keys

he Object.keys() method returns an array of a given object's own enumerable properties, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).
some example from MDN:

var arr = ['a', 'b', 'c'];
console.log(Object.keys(arr)); // console: ['0', '1', '2']

// array like object
var obj = { 0: 'a', 1: 'b', 2: 'c' };
console.log(Object.keys(obj)); // console: ['0', '1', '2']

// array like object with random key ordering
var anObj = { 100: 'a', 2: 'b', 7: 'c' };
console.log(Object.keys(anObj)); // ['2', '7', '100']

// getFoo is property which isn't enumerable
var myObj = Object.create({}, {
  getFoo: {
    value: function () { return this.foo; }
  } 
});
myObj.foo = 1;
console.log(Object.keys(myObj)); // console: ['foo']

Question:
the difference between Object.keys and Object.getOwnPropertyNames ?
answer:
the difference is whether the returned list includes the non-enumerable properties.
Object.keys does not return them, but the other one does.
linke: here

小结: 
    Object.values 读取对象可枚举的值,
    Object.keys 读取对象可枚举的键,
    如果值是一个需要深层遍历的类型,或者说是复杂类型,那么用这两个方法均无法读到该值或键。

#命令行

查看端口占用情况

sudo lsof -i:xx //xx表示端口号
#结束某个端口进行
kill xxxx(pid) //pid通过查找端口得到

/***** 2018.06.06update ********/
df -hl :查看硬盘情况
cat /etc/redhat-release: 查看系统版本信息
uname: 查看

#检查MySQL服务器是否启动

      ps -ef | grep mysqld
open . //在命令窗口执行,会打开当前路径所在文件夹

#远程拷贝

// 本地到远程服务器
scp -r local_folder remote_username@remote_ip:remote_folder

//远程到本地
scp remote_username@remote_ip:remote_folder local_folder

/**
*注意两点:

*1.如果远程服务器防火墙有特殊限制,scp便要走特殊端口,具体用什么端口视情况而定,命令格式如下:

* #scp -p 4588 [email protected]:/usr/local/sin.sh /home/administrator

*2.使用scp要注意所使用的用户是否具有可读取远程服务器相应文件的权限。
*/

#array.prototype.XXX

Array.prototype.find()

if Array has the one you try to find, it will give the element back, or it return 'undefine'
it receives Function as parameters.

following update 2017/11/24
difference between find and filter
former return the element, latter returns an array.
the same:
both not deep copy.

Array.prototype.filter()

its first parameter is Function which could has three parameters (element,index,array)
according to the Function it will return a new array that fits.
it wouldn't change the elder array.
---2017/6/28
update 2017/11/24

     a = [{name: 1}, {name: 2}, {name: 3}];
     b = a.filter(item => item.name == 1);
     b[0].name = 9;
     console.log(b);    // b => [{name: 9}] 
     console.log(a);     //a => [{name: 9}, {name: 2}, {name: 3}];

the above example tells that Array.prototype.filter is not a deep copy function. If it returns an object, it only returns pointer, not a new object. so when you change the returned one, the old one will be changed.

Array.prototype.slice

它不会改变原数组,返回一个从开始到结束(不包括)的新数组。
@params : begin (可选)剪切起始位置,默认值为0.
end(可选)剪切的结束位置,不包括该值。不填写则视为整个数组。

examples

    let a  = [1, 2, 3, 4, 5];
    let b = a.slice(1);
    console.log(a, b )     // a => [1, 2, 3, 4, 5]  ;   b => [2, 3, 4, 5]

     let c = [2, 3 , 4, 5 ];
     let d = c.slice(2, 3);
     console.log(c, d)      // c => [2, 3, 4, 5] ;        b => [4]

     let e = [1, 2, 3, 4, 5]
     console.log( e.slice() )      // e => [1, 2, 3, 4, 5]

Array.prototype.splice

该方法会改变原数组。可以对原数组进行删除或者 添加元素的操作。
返回值: 由被删除的元素组成的一个数组。如果只删除了一个元素,则返回只包含一个元素的数组。如果没有删除元素,则返回空数组。
@params:
begin: 删除的起始位置,默认值为0,如果为负值,则视为从数组末尾开始计数,删除顺序还是正的;
end: 要删除的个数,为0则不删除。
additems(个数不限): 要添加的元素,插入位置为begin的值。如果不填写该项,则视为不添加元素。

examples

     let a  = [1, 2, 3, 4];
     let b = a.splice(0,1);
     console.log(a, b)      // a=> [2, 3, 4];   b => [1]

     let c  = [1, 2, 3, 4, 5];
     let d = c.splice(6, 7);
     console.log(c ,d )     //  c => [1, 2, 3, 4, 5];   d=>[]

     let e = [1, 2, 3, 4 ];
     let f = e.splice(1, 2, 'new');
     console.log(e, f)      // e => [1, 'new', 3, 4];   f => [2]

     let g = [1, 2, 3, 4, 5];
     let h = g.splice(-2, 4);
     console.log(g ,h  )     // g => [1, 2, 3];  h => [ 4, 5] 
    //其中(-2, 4)表示从倒数第二位 `g[3]`开始,往后再数4个数,进行删除。
   //现有数组后面只剩下一个5,顾而只删除了4,5两个数。(并不会又从头开始数着删除(´・ω・)ノ)

examples:

1. Array.from

对伪数组或可迭代对象(包括arguments Array,Map,Set,String...)转换成数组对象。来自MDN

let a = [1, 2, 3, 4, 2];
let b = new Set(a);
console.log(b);     // {1, 2, 3, 4}
let c = Array.from(b);
console.log(c);    // [1, 2, 3, 4]
console.log(b);   //{1, 2, 3, 4}   该方法并不改变原对象,而是返回一个新的数组实例。

如上,是在平时中常遇到的一种情况,先用set去重,然后Array.from转换成数组格式。

Array.isArray

it's a method of Array. it aims to determin whether the values passed is an Array
@params: object
@return: true or false

examples:

Array.isArray([1, 2, 3])                        //true
Array.isArray(new Array())                //true
Array.isArray(1)                                 //false
Array.isArray('string')                       //false
Array.isArray({})                                //false

Array.isArray(Array.prototype)          //true    Array.prototype is an Array

#git 修改提交的用户名和邮箱

#前情提要: 因*&……%¥¥,公司小伙伴有事请假,借用其电脑开发几天。
#查看git 配置: git config --list,可以看到user.name / user.email为提交代码的用户名和邮箱。
#修改: git config user.name 你的用户名
git config user.email 你的邮箱
运行上面两条命令是针对项目进行修改,并非全局。
如果要修改全局的,需要加上 --global参数:即git config --global user.name & git config --global user.email
具体操作过程中,针对项目进行修改是进入项目根目录执行命令。
经测:再次提交代码,该项目的提交记录已修改为自己的。

//方法二:
打开单个项目根目录下的.git,终端可以用 open .git打开,找到config文件,打开可以修改里面的user.name & user.email.
修改全局的可以~/.gitconfig进行修改。

#遇到的问题合集

  1. 需求:2号git仓库的项目需要在1号git仓库展示,操作:先�打包2号项目代码,然后删除.git文件,将代码文件加入1号仓库,再git add => git commit => git push。发现推上去的只是一个空文件夹,然而也不能往 里面添加文件。
    报错:
fatal: Pathspec 'autoload_classmap.php' is in submodule 'module/CocktailMakerModule'这样的语句。
analysis:  一开始把含.git文件夹放入1号项目中的时候,判定为增加了一个子模块?这时再往里添加文件相当于在2号仓库做改动。

解决方案:

git rm -rf --cached module/CocktailMakerModule
git add CocktailMakerModule/

先清除之前的缓存,之后再添加。

Docker

## List Docker CLI commands
docker
docker container --help

## Display Docker version and info
docker --version
docker version
docker info

## Execute Docker image
docker run hello-world

## List Docker images
docker image ls

## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq

#Object.prototype.XXX

Object.values

返回一个给定对象自己的所有可枚举属性值的数组,值的顺序与使用for...in循环的顺序相同 ( 区别在于 for-in 循环枚举原型链中的属性 )。

参数:
Object: 被遍历对象
返回值:
array: 一个包含对象自身的所有可枚举属性键值的数组。
例子:

     let  obj = { foo: "bar", baz: 42 };
     let  result = Object.values(obj);
    console.log(result).     // ['bar', 42]

Object.getOwnPropertySymbols

it's a method returns an array of all symbol properties found directly upon a given object.

@params: object
@return: an array owned all symbol properties found directly upon a given object

Object.entries

返回一个给定对象自身可枚举属性的键值对数,其排列与使用 for...in 循环遍历该对象时返回的顺序一致(区别在于 for-in 循环也枚举原型链中的属性)

参数:
object: 被遍历的对象。
返回值:
array: 给定对象自身可枚举属性的键值对数组。
例子:

      let obj = { a: 1, b: 2, c: 3 };
      let b = Object.entries(obj);
      console.log(b);  //  [ ["a", 1], ["b", 2], ["c", 3] ]

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.