Real unit test (isolation, no children render)
Calls:
- constructor
- render
function nonCoercible(val) { | |
if (val == null) { | |
throw TypeError('nonCoercible shouldn\'t be called with null or undefined'); | |
} | |
const res = Object(val); | |
res[Symbol.toPrimitive] = () => { | |
throw TypeError('Trying to coerce non-coercible object'); | |
} | |
return res; | |
}; |
const I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |
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.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
git config --global https.proxy http://127.0.0.1:1080 | |
git config --global https.proxy https://127.0.0.1:1080 | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
npm config delete proxy |
#!/bin/bash | |
# Install daemon tools | |
if [ "$UID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
if [ ! -e /usr/bin/gcc ] || [ ! -e /usr/bin/make ]; then | |
echo gcc or make not installed going to install dev tools in 5 seconds press ^C to exit | |
sleep 6 | |
yum -y groupinstall 'Development Tools' |
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html |
常用的数字正则(严格匹配) | |
------------------------------ | |
正则 含义 | |
^[1-9]\d*$ 匹配正整数 | |
^-[1-9]\d*$ 匹配负整数 | |
^-?[1-9]\d*$ 匹配整数 | |
^[1-9]\d*|0$ 匹配非负整数(正整数 + 0) | |
^-[1-9]\d*|0$ 匹配非正整数(负整数 + 0) | |
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 匹配正浮点数 | |
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 匹配负浮点数 |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |