Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| apiVersion: networking.k8s.io/v1beta1 | |
| kind: Ingress | |
| metadata: | |
| name: example-ingress | |
| annotations: | |
| nginx.ingress.kubernetes.io/rewrite-target: /$1 | |
| spec: | |
| rules: | |
| - host: hello-world.info | |
| http: |
| export default (fileInfo, api) => { | |
| const j = api.jscodeshift; | |
| const methods = []; | |
| const root = j(fileInfo.source); | |
| const body = root.find(j.Program).get('body', 0).node; | |
| const { comments } = body; | |
| delete body.comments | |
| root.get().node.comments = comments; | |
| module.exports = (file, api, options) => { | |
| const j = api.jscodeshift; | |
| const printOptions = options.printOptions || {quote: 'single'}; | |
| const root = j(file.source); | |
| const requires = {}; | |
| const filterAndTransformRequires = path => { | |
| const varName = path.value.local.name; | |
| const scopeNode = path.parentPath.scope.node; |
First, take a look at the ESLint rule documentation. Just skim it for now. It's very long and boring. You can come back to it later.
ESLint rules works on the AST (Abstract Syntax Tree) representation of the code. In short, this is a tree structure that describes the code in a very verbose form. ESLint walks this tree and rules can subscribe to be notified when it hits a specific node type, like a Literal type, which could be the "hello" part of const welcome = "hello";.
Go ahead and play around with some code in AST Explorer (Make sure the parser is espree). It's a great tool!
Here are some good articles on the subject (ignore the scaffolding parts):
| 非常有意思的一组正则小游戏,http://regex.alf.nu/ | |
| 积分规则:匹配左边(一个10分),不匹配右边的(错误一个扣10分),式子长度越短越好,1个字符扣1分。 | |
| 中间有被难到的题目参考了Gist: https://gist.github.com/Davidebyzero/9221685 | |
| 我看懂了的,顺便也记录一下我的理解。 | |
| Regex: short of regular expression. | |
| Warmup | |
| foo,哈哈,送分题 | |
| Anchors | |
| You are deducted one point per character you use, and ten if you match something you shouldn’t. | |
| 我写的是ick$,后来发现还有k$,太坏了。。。考察点是:start/end of string anchors. |
| {"lastUpload":"2019-01-16T07:36:10.774Z","extensionVersion":"v3.2.4"} |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParentelem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeightelem.getClientRects(), elem.getBoundingClientRect()