The following is a list of Redux resources, as described to me by Dan Abramov.
"Real World Redux" talk
Reselect
Sunil Pai is building an Om Next clone in vanilla JS
| // https://jsbin.com/tebevak/edit?js,output | |
| // .append via https://github.com/WebReflection/dom4/#dom4 | |
| const dom = new Proxy({}, { | |
| get(target, property) { | |
| return function (attrs = {}, ...children) { | |
| const el = document.createElement( | |
| property.replace(/[a-z][A-Z]/g, '$1-$2')); | |
| for (let prop of Object.keys(attrs)) | |
| el.setAttribute(prop, attrs[prop]); | |
| el.append(...children); |
| var DOMClass = (function (O,o) { | |
| /*! (C) Andrea Giammarchi */ | |
| var | |
| create = O.create, | |
| css = create(null), | |
| dP = O.defineProperty, | |
| gOPD = O.getOwnPropertyDescriptor, | |
| gOPN = O.getOwnPropertyNames, |
| // Original from http://stackoverflow.com/questions/1638337/the-best-way-to-synchronize-client-side-javascript-clock-with-server-date | |
| // Improved by community and @jskowron | |
| // Synchronize client-side clock with server time using an approximation of NTP | |
| let serverTimeOffset = null; | |
| function getServerTime(callback) { | |
| if (serverTimeOffset === null) { | |
| const scripts = document.getElementsByTagName("script"); | |
| const currentScriptURL = scripts[scripts.length - 1].src; |
The following is a list of Redux resources, as described to me by Dan Abramov.
"Real World Redux" talk
Reselect
Sunil Pai is building an Om Next clone in vanilla JS
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| theme: Ember.inject.service() | |
| // ... | |
| }); |
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |
| /*\ | |
| title: $:/plugins/sukima/dombuilder/dombuilder.js | |
| type: application/javascript | |
| module-type: library | |
| Micro DSL for DOM creation and stringification. | |
| \*/ | |
| /** |
| by Addy Osmani (@addyosmani) | |
| https://twitter.com/addyosmani/status/743571393174872064 | |
| ——— | |
| Preresolve DNS hostnames for assets | |
| <link rel="dns-prefetch" href="https://my-site.com"> | |
| Begin a connection handshake in the background | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| webpack --display-modules | awk '{print $3$4" "$2}' | grep -v bytes | sort -n | tail -100 |
| import React from 'react'; | |
| const MIN_SCALE = 1; | |
| const MAX_SCALE = 4; | |
| const SETTLE_RANGE = 0.001; | |
| const ADDITIONAL_LIMIT = 0.2; | |
| const DOUBLE_TAP_THRESHOLD = 300; | |
| const ANIMATION_SPEED = 0.04; | |
| const RESET_ANIMATION_SPEED = 0.08; | |
| const INITIAL_X = 0; |