This file contains hidden or 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 data = {...} | |
var react = React.renderComponentToString(<Component data={data} />); | |
writeToClient( | |
'<html><head><script src="myCompiledJS.js"></script></head>' + | |
'<body><div id="foo">' + react + '</div>' + | |
'<script>React.renderComponent('+ | |
'Component({data:'+ JSON.stringify(data) + '}), document.getElementById("foo")'+ | |
')</script>' + | |
'</body></html>' |
This file contains hidden or 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 handleClick(element, event) { | |
if (event.button === 1) { | |
return { count: 0 }; | |
} | |
if (element.props.onClick) { | |
element.onClick(); | |
} | |
element.updateState(s => {...s, count: s.count + 1 }); | |
} |
This file contains hidden or 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 insertCSS = require('insert-css') | |
insertCSS('.foo { color: red; }') | |
var React = require('react/addons'); | |
var CSSCore = require('react/lib/CSSCore'); | |
window.r = React; | |
var Component = React.createFactory(React.createClass({ | |
render: function() { |
This file contains hidden or 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 trivial example of using Immutable structures as React state. | |
Note that replaceState() must be used instead of setState(), as setState expects | |
an object literal and will merge it (Object.assign) with the previous state. | |
replaceState() is a simple swap. | |
*/ |
This file contains hidden or 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
beforeEach(function () { | |
this.addMatchers({ | |
is: function(expected) { | |
return Immutable.is(this.actual, expected); | |
} | |
}) | |
}) |
This file contains hidden or 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
/* | |
At some point I connected Facebook friends to Amazon wishlists. Now I get | |
multiple emails from Amazon for the birthday of everyone I ever met. | |
Removing people from this list requires a bunch of manual clicking. | |
Automation FTW. | |
1) http://www.amazon.com/gp/registry?ie=UTF8&type=wishlist |
This file contains hidden or 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
import * as foo from "foo" | |
var $foo = require("foo"); | |
var foo = $foo; | |
import foo from "foo" | |
var $foo = require("foo"); | |
var foo = $foo.default; | |
import { foo } from "foo" | |
var $foo = require("foo"); |
This file contains hidden or 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> | |
<script src="http://fb.me/react-with-addons-0.12.0.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or 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> | |
<script src="http://fb.me/react-with-addons-0.12.0.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# first load in the master bash | |
if [ -f /etc/master_bash ]; then | |
. /etc/master_bash |