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 TransformProps = (Component, transform) => class extends React.Component { | |
displayName = Component.displayName; | |
render() { | |
return <Component {...transform(this.props)}>; | |
} | |
}; | |
const transform = (f) => (t) => { | |
r = {}; |
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
// is A an extension of B ? | |
// ex: | |
// class C extends Oject {} | |
// class B extends C {} | |
// class A extends B {} | |
// isExtension(A, B) === true | |
// isExtension(A, C) === true | |
// isExtension(A, Object) === true | |
// isExtension(B, A) === false | |
function isExtensionOf(A, B) { |
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 client = new FluxClient('http://localhost:8080'); | |
const messageList = client.Store('/messageList'); | |
const postMessage = client.Action('/postMessage'); | |
const MessageList = React.createClass({ | |
getInitialState() { | |
return { messageList: this.props.messageList.head, message: null }; | |
}, | |
componentDidMount() { | |
messageList.onUpdate(({ head }) => this.setState({ messageList: head })); |
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 server = new FluxServer(8080); | |
const messageList = server.Store('/messageList'); | |
messageList.set('nextId', 0).commit(); | |
const postMessage = server.Action('/postMessage') | |
.onDispatch(({ nickname, message }) => { | |
messageList.set(messageList.get('nextId') + 1, { nickname, message }) | |
.set('nextId', messageList.get('nextId') + 1) | |
.commit() | |
}); |
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
Full stack flux | |
^ Actions go up v Updates go down | |
PostgreSQL (shardable) | |
^ Stored procedures v NOTIFY | |
Node PostegreSQL/redis broker (clusterable) | |
^ PUBLISH v SUBSCRIBE | |
redis MQ (shardable) | |
^ PUBLISH v SUBSCRIBE |
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 renderToObject(element) { | |
const inst = instantiateReactComponent(element); | |
inst.state = inst.getInitialState ? inst.getInitialState() : null; | |
return Promise.resolve(inst.componentWillMount ? inst.componentWillMount() : null) | |
.then(() => { | |
const r = inst.render(); | |
inst.componentWillUnmount(); | |
return r; | |
}); | |
} |
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
alias git-patch="git add -A && git commit -m" | |
alias npm-patch="npm version patch && git push && git push --tags && npm publish" | |
alias npm-minor="npm version minor && git push && git push --tags && npm publish" | |
alias npm-major="npm version major && git push && git push --tags && npm publish" | |
alias npm-upgrade="npm cache clear && npm-check-updates -u && npm install" |
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 AsyncDependencies = require("react-asyncdependencies"); | |
var request = require("request"); | |
var TodoList = React.createClass({ | |
mixins: [AsyncDependencies.Mixin], | |
getInitialState: function() { | |
return { | |
todosIds: null, | |
}; | |
}, |
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
.DropDown-backdrop { | |
display: none; | |
position: fixed; | |
top: 0; | |
left: 0; | |
bottom: 0; | |
right: 0; | |
z-index: 100; | |
} | |
.DropDown.open .DropDown-backdrop{ |
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
/** @jsx React.DOM */ | |
var React = require("react"); | |
var AnimateMixin = require("react-animate"); | |
var fromCSS = require("react-css").fromCSS; | |
var from = fromCSS("{" + | |
"transform: rotate(0deg);" + | |
"background-color: blue;" + | |
"margin: 50px;" + | |
"width: 200px;" + |