Flux 的威力在于其函数式编程 -> no side effects(to MVC)。
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
body { | |
font-family: Helvetica, Arial, 'PingFang SC', 'Lantinghei SC', 'Microsoft Yahei', sans-serif; | |
text-rendering: geometricPrecision; | |
font-kerning: auto; | |
-webkit-font-smoothing: antialiased; | |
font-variant-ligatures: common-ligatures discretionary-ligatures; | |
-webkit-font-feature-settings: "liga", "dlig"; | |
font-feature-settings: "liga", "dlig"; | |
} |
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
/* | |
* This is a dummy function to check if the function name has been altered by minification. | |
* If the function has been minified and NODE_ENV !== 'production', warn the user. | |
*/ | |
function isCrushed() {} | |
if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') { | |
(0, _warning2["default"])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.'); | |
} |
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 f1(name, a) { | |
if (name == 'sin') { return Math.sin(a); } | |
if (name == 'cos') { return Math.cos(a); } | |
return 1; | |
} | |
function f0(name) { | |
if (name == 'sin') { return 1; } | |
if (name == 'cos') { return 2; } | |
return 1; | |
} |
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
/* Open Sans */ @import url(https://fonts.googleapis.com/css?family=Quicksand:700|Open+Sans:400,400italic,700italic,700); body { font-family: 'open sans', 'pingfang sc', sans-serif; } | |
/* Arvo */ @import url(https://fonts.googleapis.com/css?family=Arvo:400,400italic,700,700italic); body { font-family: 'arvo', 'pingfang sc', sans-serif; } | |
/* Lato */ @import url(https://fonts.googleapis.com/css?family=Lato:400,400italic,700,700italic); body { font-family: 'lato', 'pingfang sc', sans-serif; } | |
/* Vollkorn */ @import url(https://fonts.googleapis.com/css?family=Vollkorn:400,400italic,700,700italic); p { font-family: 'vollkorn', 'stsong', 'simsun', serif; font-size: 110%; } |
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
Number.prototype[Symbol.iterator] = function *() { let len = this.valueOf(); for(let i = 0; i < len; ++i) yield i; }; | |
for (let i of 16) { console.log(i); } |
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
// random numbergenerator between 0 and 1 | |
var randomNum = ((Math.random () * 2 | 0) + 1) - 1; | |
// jquery inline style w/ !important | |
$(el).css("cssText", "overflow: visible !important;"); | |
// random numbergenerator between 1 and 100 | |
Math.round((Math.random() * 99) + 1) | |
(+new Date() + Math.floor(Math.random()*999999)).toString(36) |
- https://www.oreilly.com/ideas/brendan-eich-javascript-fluent-2016 brendan eich
- https://www.youtube.com/watch?v=1ToJ7cxb1R8
- https://www.youtube.com/watch?v=-t8eOoRsJ7M
- https://www.youtube.com/watch?v=uvAXVMwHJXU dan abramov
- https://www.youtube.com/watch?v=dOSwHABLvdM
- https://www.youtube.com/watch?v=PDusOGAFJLQ substack
- https://www.youtube.com/watch?v=RPFjN1N148U substack
- https://www.youtube.com/watch?v=GJhN4aop2_g substack
- https://www.youtube.com/watch?v=DCQNm6yiZh0 substack
- https://www.youtube.com/watch?v=cmGr0RszHc8 google io 16, offline first web apps
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 d=(f,t=f(),r=t.next())=>r.done||setTimeout(d,r.value,f,t); | |
d(function *() { | |
console.log('foo'); | |
yield 1000; | |
console.log('bar'); | |
yield 1000; | |
console.log('baz'); |
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 pureRender = (Component) => { | |
Object.assign(Component.prototype, { | |
shouldComponentUpdate (nextProps, nextState) { | |
return !shallowEqual(this.props, nextProps) || | |
!shallowEqual(this.state, nextState); | |
} | |
}); | |
}; | |
module.exports = pureRender; |