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
private String implementation1(String name, Category category, Long offset) throws CoreException | |
{ | |
StringBuilder b = new StringBuilder(); | |
//create the xpath | |
String xpath = | |
"//Products.Product[Products.Product_ProductState/Products.ProductState[Published = true() or PublishAnyway = true()]]" + | |
"[Products.Product_Category = '" + category.getGUID() + "']" + | |
"[Name = '" + name + "']"; |
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
//... | |
//create the xpath | |
String xpath = String.format("//%s[%s/%s[%s = true() or %s = true()]][%s = '%s'][%s = '%s']", | |
Product.entityName, | |
Product.MemberNames.Product_ProductState, ProductState.entityName, | |
ProductState.MemberNames.Published, ProductState.MemberNames.PublishAnyway, | |
Product.MemberNames.Product_Category, category.getGUID(), | |
Product.MemberNames.Name, name | |
); | |
//... |
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
private String implementation4(String name, Category category, Long offset) throws CoreException | |
{ | |
StringBuilder b = new StringBuilder(); | |
//create the xpath | |
XPath<Product> xpath = XPath.create(getContext(), Product.class) | |
.subconstraint( Product.MemberNames.Product_ProductState , ProductState.entityName ) | |
.eq( ProductState.MemberNames.Published , true ) | |
.or() | |
.eq( ProductState.MemberNames.PublishAnyway , true ) |
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 CartEntryView = mobxReact.observer(React.createClass({ | |
render: function() { | |
return (<li> | |
// etc... |
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 Article(name, price) { | |
mobx.extendObservable(this, { | |
name: name, | |
price: price | |
}); | |
} | |
function ShoppingCartEntry(article) { | |
mobx.extendObservable(this, { | |
article: article, |
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 CartView = React.createClass({ | |
render: function() { | |
function renderEntry(entry) { | |
return (<CartEntryView entry={entry} cart={this.props.cart} key={entry.id} />); | |
} | |
return (<div> | |
<ul id="cart">{this.props.cart.entries.map(renderEntry)}</ul> | |
<div><b>Total: <span id="total">{this.props.cart.total}</span></b></div> | |
</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
npm init -y && npm install mobx --save && node -e "global.mobx=require('mobx'); require('repl').start({ useGlobal: true});" |
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
// The state of our app | |
var state = mobx.observable({ | |
nrOfSeats : 500, | |
reservations : [], | |
seatsLeft : function() { return this.nrOfSeats - this.reservations.length; } | |
}); | |
// The UI; a function that is applied to the state | |
var ui = mobx.computed(function() { | |
return "\n<div>Seats left: " + state.seatsLeft + |
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
<div>Seats left: 500<hr/>Attendees: </div> | |
<div>Seats left: 499<hr/>Attendees: Michel</div> | |
<div>Seats left: 498<hr/>Attendees: Michel, You?</div> | |
<div>Seats left: 498<hr/>Attendees: @mweststrate, You?</div> | |
<div>Seats left: 748<hr/>Attendees: @mweststrate, You?</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
// JSBin: http://jsbin.com/xoyehi/edit?js,console | |
import {observable, autorun} from "mobx"; | |
const todos = observable([{ | |
title: "Find napkin", | |
completed: false | |
}]); | |
autorun(() => | |
console.log(todos |
OlderNewer