NPM + NPX

npm init                            # questionnaire to create package.json
npm init --yes                      # creates a default package.json

npm install <package-name>          # install local package
npm install package@1.1.5           #install specific version of a package
npm run <script>                    # run 'scripts' of package.sjon

npm list                            # list installed packages
npm outdated                        # list outaded packages
npm update <package-name>           # update package
npm uninstall <package-name>        # unsinstall local package

npm search <package-name>           # search for packages

npm install -g <package-name>       # install GLOBAL packake


# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

# install depedencies from package.json & package-lock.json
npm install

# npm version
npm -v

# Show packages installed in global mode
npm list -g --depth 0

VSCode

Ctrl+K Ctrl+C             # Comment line

MkDocs

pip3 install mkdocs                         # Install mkdocs
pip3 install mkdocs-material                # Install material theme

Pipenv (python virtual environments)

Regular expression

    .       - Any Character Except New Line
    \d      - Digit (0-9)
    \D      - Not a Digit (0-9)
    \w      - Word Character (a-z, A-Z, 0-9,_) ( it is called shorthand character classes)
    \W      - Not a word character
    \s      - Whitespace (space, tab, newline, form feed) [ \r\t\f\n\v]
    \S      - Not Whitespace (space, tab, newline)
    
    \b      - Word Boundary : limite de mot
    \B      - Not a Word Boundary
    ^       - Beginning of a String (or line, row ) [^ \r\t\f\n\v]
    $       - End of a String
    
    []      - Matches Characters in Brackets ( it is called character set )
    [^ ]    - Matches Characters NOT in Brackets
    |       - Either value OR value e.g. /[yes|not]/
    ()      - Group
    
    Quantifiers:
    *       - 0 or More of the preceding token( greedy)  equivalent to {0,}
    +       - 1 or More            equivalent to {1,}
    ?       - 0 or One  (lazy)(e.g. select 'Mr.' or 'Mr' regex: /Mr\.?/  )  equivalent to {0,1}
    {3}     - Exac

Resource dictionary in a separate file

[LINK](https://social.msdn.microsoft.com/Forums/vstudio/en-US/e37b528e-f797-4b91-84fe-03ddd7fb57c1/custom-style-in-an-external-file?forum=wpf)
<StackPanel.Resources>
  <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="/Styles/MyFile.xaml" /> <!--Folder "Styles" in the project-->>
    </ResourceDictionary.MergedDictionaries>
  </ResourceDictionary>
</StackPanel.Resources>

Unique BST - CATALAN NUMBER

//To use less space we could use a hashMap!

class Solution {
    public int numTrees(int n) {
       
        HashMap <Integer, Integer> nthCatalan = new HashMap<>();
        nthCatalan.put(0,1);
        nthCatalan.put(1,1);
        nthCatalanNumber(n, nthCatalan);
        
        return nthCatalan.get(n);
        
    
    }
    
    public void nthCatalanNumber(int n, HashMap<Integer, Integer> nthCatalan){            
        //TODO: Body of recursion
        int nth = 0;
        int smaller, bigger;
        for(int i=1; i<=n; i++){
            
            if(!nthCatalan.containsKey(i-1)) nthCatalanNumber(i-1, nthCatalan);
            smaller = nthCatalan.get(i-1);
            
            if(!nthCatalan.containsKey(n-i)) nthCatalanNumber(n-i, nthCatalan);
            bigger = nthCatalan.get(n-i);
            
            nth += smaller*bigger;
        }  
        
        nthCatalan.put(n, nth);
        return;
    }
}

Typescript Hoc

import React from 'react';

function getDisplayName(WrappedComponent) {
  return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}

export function withContainer<P>(injectedProps: P) {
  return function<T extends P>(WrappedComponent: React.FC<T>) {
    const hocComponent = (props: Omit<T, keyof P>) => (
      <WrappedComponent
        {...props as T} // this 'as T' should be explicit
        {...injectedProps}
      />
    );

    hocComponent.displayName = `WithContainer(${getDisplayName(
      WrappedComponent,
    )})`;

    return hocComponent;
  };
}

C codes, sequences, format specifiers


| Special Character  | Escape Sequence  |
|--------------------|------------------|
| alert (beep)  | \a  | 
| backslash  | \\  | 
| backspace  | \b  |
| carriage return  | \r  |
| double quote  | \\"  |
| formfeed  | \f  |
| horizontal tab	  | \t  |
| newline | \n  |
| null character  | \0  |
| single quote |	\\' |
| vertical tab | \v  |
| question mark | \? |

lepton #spark #scala

lepton #spark #scala
# 快速构建 Flink 项目 
{% tabs first="方式1", second="方式2", third="方式3" %}
{% content "first" %}
```bash
mvn archetype:generate \
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-scala \
-DarchetypeVersion=1.8.0
```
{% content "second" %}
```bash
curl https://flink.apache.org/q/quickstart-scala.sh | bash -s 1.8.0
```
{% content "third" %}

![idea 中创建 Flink 项目](./image/create_flink_project_in_idea.png)

{% endtabs %}
# Flink 快速入门
{% tabs first="batch", second="stream" %}
{% content "first" %}
[WordCount-Batch](https://github.com/apache/flink/blob/master/flink-examples/flink-examples-batch/src/main/scala/org/apache/flink/examples/scala/wordcount/WordCount.scala)
{% content "second" %}
[WordCount-Stream](https://github.com/apache/flink/blob/master/flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/wordcount/WordCount.scala)
{% endtabs %}

Вывести объекты на карте Yandex.Maps

```
https://tech.yandex.ru/maps/jsbox/2.1/object_list
```

confirm dialog

.confirm-wrapper {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: gray;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
    transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
    z-index: 1;
}
.confirm-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
.confirm-container {
    background-color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 0.2em;
    min-width: 300px;
}
.confirm-title-container {
    font-size: 1.3em;
    padding: 10px;
    border-top-left-radius: 0.2em;
    border-top-right-radius: 0.2em;
}
.confirm-content-container {
    padding: 0px 10px 15px 10px;
}
.confirm-buttons-container {
    padding: 5px 15px 10px 15px;
    text-align: right;
}
.confirm-buttons-container button {
    margin-left: 10px;
    

flink 源码编译 #flink

flink 源码编译 #flink
xxx

MongoDB Database Connection Using Mongoose

const connectDB = async () => {
	try {
		await mongoose.connect(config.get('db'), {
			useNewUrlParser: true,
			useCreateIndex: true
		});
		console.log('Database Connected');
	} catch (e) {
		console.log(e);
	}

	const connection = mongoose.connection;
	connection.on('connected', () => {
		console.log('Database Connected Successfully');
	});

	connection.on('disconnected', () => {
		console.log('Database Disconnected');
	});

	connection.on('error', err => {
		console.log('Error Occurred', err);
	});

	connection.on('close', () => {
		console.log('Database Closed Successfully');
	});
};

parse instagram

Parse pictures and info from instagramm
from selenium import webdriver
from bs4 import BeautifulSoup as bs
import time
import re
from urllib.request import urlopen
import json
from pandas.io.json import json_normalize
import pandas as pd, numpy as np


num_pages = 100
hashtag='selfie'
# check for selfiegram, selfiestick, selfiequeen, selfienation, selfiesunday, selfietime, selfies, selfie, selfieofday, selfiesfordays, makeup, beauty, me, 

'''
username='vasily.onl'
browser = webdriver.Chrome('C:/chromedriver.exe')
browser.get('https://www.instagram.com/'+username+'/?hl=en')
Pagelength = browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
'''


browser = webdriver.Chrome('C:/chromedriver.exe')
browser.get('https://www.instagram.com/explore/tags/'+hashtag)
Pagelength = browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")

Pagelength = browser.execute_script("window.scrollTo(0, document.body.scrollHeight/1.5);")

links = []

source = browser.page_source
d

Cards links clickable

imaginemos que tenemos una card que toda su área es clickable, y que dentro tiene un link. Estamos ante un evento de click redundante. En este artículo se muestra una posible implementación que tiene en cuenta la accesibilidad.
- Cards: https://inclusive-components.design/cards/