xvno / blog Goto Github PK
View Code? Open in Web Editor NEW个人博客, 不定期发布技术笔记和个人随笔.
个人博客, 不定期发布技术笔记和个人随笔.
--
double-dash:The double dash "--" means "end of command line flags" i.e. it tells the preceding command not to try to parse what comes after command line options.
Suppose there is a file called main
(or master
, it is a branch-ish name, easy to mixed with the git branch)
If it has been modified and then we wanna undo that.
Checkout this file from the last commit:
git checkout main # this will lead to checking out the branch of main
git checkout -f -- main # this will do
Also, another example: when -f
is the stupid file name
git checkout -f # Oops....
git checkout -- -f
git branch -m master main
git fetch origin
git branch -u origin/main main
if other one changed branch name, also
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
<body>
<canvas id="target">你的垃圾浏览器不支持Canvas, 赶紧换</canvas>
</body>
Methods | Description |
---|---|
getContext() | ... |
toDataURL(type, quality) | ... |
toBlob(cb, type, args...) | ... |
Attributes | Description |
---|---|
width | ... |
height | ... |
const canvas = document.querySelector('#target');
const ctx = canvas.getContext('2d')
methods | Description |
---|---|
beginPath | ... |
closePath | ... |
lineTo | ... |
moveTo | ... |
fill | ... |
stroke | ... |
fillText | ... |
clearRect | ... |
arc | ... |
--- | --- |
getImageData | |
putImageData |
Attributes | Description |
---|---|
canvas | |
--- | --- |
fillStyle | |
strokeStyle | |
shadowBlur | |
shadowColor | |
shadowOffsetX | |
shadowOffsetY | |
--- | --- |
font | |
textAlign | |
textBaseline | |
--- | --- |
lineCap | butt, round, square |
lineWidth | 1 |
lineJoin | miter, bevel, round |
miterLimit | |
--- | --- |
globalAlpha | |
globalCompsiteOperation |
configurable
true if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
Defaults to false.
enumerable
true if and only if this property shows up during enumeration of the properties on the corresponding object.
Defaults to false.
A data descriptor also has the following optional keys:
get
A function which serves as a getter for the property, or undefined if there is no getter. When the property is accessed, this function is called without arguments and with this set to the object through which the property is accessed (this may not be the object on which the property is defined due to inheritance). The return value will be used as the value of the property.
Defaults to undefined.
set
A function which serves as a setter for the property, or undefined if there is no setter. When the property is assigned, this function is called with one argument (the value being assigned to the property) and with this set to the object through which the property is assigned.
Defaults to undefined.
value
The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).
Defaults to undefined.
writable
true if the value associated with the property may be changed with an assignment operator.
Defaults to false.
An accessor descriptor also has the following optional keys:
[2019-4-27] ~~**这些组合就是抬杠~ 就两种继承方式: 1. 原型链 2. class-extends**~~
[2020-5-19] **这些组合就是抬杠~ 就一种继承方式: 原型继承
BFC 是 Block Formatting Context 的简写,它会创建一个特殊的区域,在这个区域中,只有 block box(指 display 属性为 block、list-item、table、run in box 的元素) 参与布局。而 BFC 的一套特点和规则就规定了在这个特殊的区域中如何进行布局,如何进行定位,区域内元素的相互关系和相互作用。这个特殊的区域不受外界影响。
MDN 总结如下:
格式: Mon, 20 May 2019 01:44 GMT
从HTML或XML文件中提取数据的Python库
Web 前端有 jQuery/Zepto, node 技术栈有 Cheerio, python 有 BeautifulSoup
用简单方式实现防抖和节流函数, 可作为utility函数用在前端页面控制用户行为上~ 避免引入underscore
## oh-my-zsh theme
function venv_status {
if [ -z ${PYENV_VERSION+x} ]; then
echo 'NOT SET'>/dev/null;
else
echo "($PYENV_VERSION)";
fi
}
## use in prompt
$(venv_status)
## make commands alias
### src => source ~/.zshrc
alias pa="pyenv activate && src"
alias pd="pyenv deactivate && src"
# ano.zsh-theme
# Use with a dark background and 256-color terminal!
# Meant for people with node, ruby and git.
function prompt_char {
git branch >/dev/null 2>/dev/null && echo "➤" && return
echo "➤"
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
}
local node_version='$(node --version)'
#local py_version="py-$(python -V | awk -F ' ' '{print $2}')"
#local ruby_env='$(rvm current)'
local go_version="$(go version | awk -F ' ' '{print $3}')"
local current_dir='${PWD/#$HOME/~}'
local git_info='$(git_prompt_info)'
local prompt_char='$(prompt_char)'
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="$reset_color($FG[200]✘✘✘$reset_color)"
ZSH_THEME_GIT_PROMPT_CLEAN="$reset_color($FG[040]✔✔✔$reset_color)"
function venv_status {
if [ -z ${PYENV_VERSION+x} ]; then
echo 'NOT SET'>/dev/null;
else
echo "($PYENV_VERSION)";
fi
}
#PROMPT="──${prompt_char}$FG[040]%n$reset_color@$FG[033]$(box_name) $terminfo[bold]$FG[226]${current_dir} $FG[200]${git_info} $FG[040]${node_env} $FG[001]${ruby_env} $reset_color
#PROMPT="──${prompt_char}$FG[040]%n$reset_color@$FG[033]$(box_name) $terminfo[bold]$FG[226]${current_dir} $FG[200]${git_info} $FG[040]${node_version} $FG[033]${go_version} $FG[040]${py_version} $reset_color
PROMPT="──$(venv_status)$FG[040]%n$reset_color@$FG[033]$(box_name) $terminfo[bold]$FG[226]${current_dir} $FG[200]${git_info} $FG[040]${node_version} $FG[033]${go_version}$reset_color
➤➤"
# ${prompt_char}${prompt_char}${prompt_char}"
# PROMPT="$FG[040]%n$reset_color@$FG[033]$(box_name) $terminfo[bold]$FG[226]${current_dir} $FG[200]${git_info}$reset_color
# ➤➤➤"
function totalOrdering(arr) {
function cloneArr(arr) {
let ret = []
if (arr instanceof Array) {
arr.forEach(i => {
ret.push(i);
})
}
return ret;
}
let totalArrays = []
function arrange(arr, segArr) {
if(arr.length === 1) {
segArr.push(arr[0]);
totalArrays.push(segArr);
} else {
for(let i = 0, len = arr.length; i < len; i++) {
let segArr2 = cloneArr(segArr);
let arr2 = cloneArr(arr);
let cur = arr2.splice(i, 1);
segArr2.push(cur[0]);
console.log(i, arr2, segArr2)
arrange(arr2, segArr2);
}
}
}
arrange(arr, []);
return totalArrays;
}
let a = [1,3,4];
let aaa = totalOrdering(a)
console.log(aaa)
//console.log(totalOrdering(a));
transition: <propertyName time/timing-function>[,<propertyName time/timing-function>[,...]];
transition: all time/timing-function;
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
Uncaught ReferenceError: XXX is not defined
.VariableObject
, 此时确定了作用域;ExecutionContext
, 它 确定了 this
+ ActiveObject(VariableObject)
+ Scopes
, 此时确定了作用域链: 当前 ActiveObject 和外层所有 ActiveObject 组成(保证了变量和函数的有序访问,即如果当前作用域中未找到,则继续向上查找直到全局作用域。)考虑一下代码, 最终sub和sub2是什么
function Sup() {
this.age = 0;
this.name = 'Sup';
this.isStudent = false;
this.getName = function() {
return this.name;
}
this.titles = ['SE', 'SM'];
this.profession = {
pm: 'C++',
fe: 'JavaScript'
};
}
function Sub() { }
let sup = new Sup();
Sub.prototype = sup;
let sub = new Sub();
let sub2 = new Sub();
sub.age = 0;
sub.name = 'sub...';
sub.isStudent = false;
sub.getName = function() {
return 'My name is ' + this.name;
}
sub.titles.push('CTO');
sub.profession.skill = 'Viso';
在实例对象中修改属性对象时要注意, 若它是位于原型对象上的引用类型, 容易改变原型(e.g. b.X.value = 'xxx', 若 X是b原型上的对象).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.