This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="ellips"> | |
<div class="dot"></div> | |
</div> | |
$pi: 3.14159265359; | |
$_precision: 10; | |
@function pow($base, $exp) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pi: 3.14159265359; | |
$_precision: 10; | |
@function pow($base, $exp) { | |
$value: $base; | |
@if $exp > 1 { | |
@for $i from 2 through $exp { | |
$value: $value * $base; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const log = (store) => (next) => (action) { | |
console.log('start') | |
next(action) | |
console.log('end') | |
} | |
function applayMiddleware (...middlewares) { | |
return (createStore) { | |
return (reducer, preloadedState,enhancer){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style> | |
#marquee { | |
height:120px; | |
overflow:hidden; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fnWrapDecorator(fn) { | |
return (...args) => { | |
return (target, propertyKey, descriptor) => { | |
const fn = descriptor.value | |
let wrappedFn = fn.applay(null, [fn, ...args]) | |
return { | |
configurable: true, | |
get() { | |
return fn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = {} | |
Object.defineProperty(foo, 'name', { | |
configurable: true, //是否可以delete foo.delete | |
enumerable: true, // 是否for in可以返回属性 | |
writable:true, //是否可以重新赋值 | |
value: 'kobe' | |
}) | |
var descriptor = Object.getOwnPropertyDescriptor(foo, 'name') | |
console.log(descriptor.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element | |
document | |
window | |
XMLHttpRequest | |
... | |
onchange={(e:FormEvent<HTMLInputElement>) => { | |
event.currentTarget | |
const v = e.target.value // property 'value' does not exit on type 'EventTarget' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.listing-item__title | |
.listing-item__item--active | |
// - 两个单词的链接 | |
//__ element | |
// -- midifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = {a: 1, b:2} | |
console.log(JSON.stringify(obj)) // {"a":1,"b":1} | |
var obj1 = { | |
a:1, | |
b: function() { | |
console.log(1) | |
}, | |
c: undefined | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sinon spies, stubs(stəb,存根), mocks | |
spies sinon.spy() //会调用原来的function | |
stubs //完全代替之前的function,不会执行原来的function | |
mocks //和stubs一样,可以用来替换整个对象以改变其行为 | |