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
/* App.makeProps */ | |
static makeProps($) { | |
return { | |
/* call Box.makeProps to construct the substate */ | |
box1: [Box, "1"], | |
box2: [Box, "2"], | |
/* call OtherData.makeProps to get the substate */ | |
OtherData | |
} | |
} |
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
class App extends React.Component { | |
static makeProps($) { | |
return { | |
box1: $.box1, | |
box2: $.box2, | |
otherData: $.otherData || "Default Value" | |
} | |
} | |
render() { |
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
class ReactBase extends React.Component { | |
/* event emitting function, for completeness' sake */ | |
emit(eventName, eventData = {}) { | |
this.props.dispatch(eventName, eventData); | |
} | |
shouldComponentUpdate(nextProps) { | |
return !_.isEqual(this.props, nextProps); | |
} |
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
class App extends React.Component { | |
render() { | |
const $ = this.props | |
return ( | |
<div> | |
<Box {...$.box1} /> | |
<Box {...$.box2} /> | |
</div> | |
); |
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
class ReactBase extends React.Component { | |
shouldComponentUpdate(nextProps) { | |
/* function from lodash */ | |
return !_.isEqual(this.props, nextProps); | |
/* if we use immutableJS we could also just do an equality check */ | |
// return this.props !== nextProps; | |
} | |
} |
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
/* my state */ | |
state = { | |
box1: {data: "Box 1", top: 0, left: 0}, | |
box2: {data: "Box 2", top: 0, left: 100}, | |
otherData: {} | |
} | |
class App extends React.Component { | |
render() { | |
const $ = this.props |
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
$app->view = new \Slim\Views\Twig(); | |
$app->view->setTemplatesDirectory(__DIR__."/templates/"); | |
$app->view->parserOptions = ['debug' => $config['debug']]; | |
$app->view->parserExtensions = [new \Slim\Views\TwigExtension()]; | |
$app->get('/(:page)', function ($page = "intro") use ($app, $config) { | |
try { | |
$app->render('wrapper.html', [ | |
'page' => $page, | |
'debugEnabled' => ($config['debug'] ? "true" : "false") |
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
import static com.google.common.base.Preconditions.checkState; | |
import java.nio.file.Path; | |
import java.util.Iterator; | |
import java.util.List; | |
public final class SWTLoader extends Capsule { | |
// ~ Constructors ---------------------------------------------------------------------------------------------- |
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
<?xml version="1.0"?> | |
<project name="createRMapping" default="main"> | |
<property name="package" value="org.somecompany.somepackage" /> | |
<target name="main"> | |
<script language="javascript"> | |
<classpath> | |
<fileset dir="libs" includes="guava*.jar" /> | |
</classpath> |