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
// First, define `nestedTypes` in your model. | |
// Each nested type may be a Model or Collection subtype. | |
window.app.viewer.Model.GallerySection = window.app.Model.BaseModel.extend({ | |
nestedTypes: { | |
background: window.app.viewer.Model.Image, | |
images: window.app.viewer.Collection.MediaCollection | |
} | |
}); |
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
'use strict'; | |
var q = require('q'); | |
/** | |
* Constructs a function that proxies to promiseFactory | |
* limiting the count of promises that can run simultaneously. | |
* @param promiseFactory function that returns promises. | |
* @param limit how many promises are allowed to be running at the same time. | |
* @returns function that returns a promise that eventually proxies to promiseFactory. |
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 mongoose = require('mongoose') | |
, Q = require('q') | |
, Wallet = mongoose.model('Wallet') | |
, _ = require('underscore') | |
, bitcoin = require('bitcoin'); | |
function connect(coin) { | |
return new bitcoin.Client({ | |
host: coin.host, | |
port: coin.port, |
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 */ | |
/* jshint trailing:false, quotmark:false, newcap:false */ | |
define(function (require) { | |
'use strict'; | |
var React = require('react'), | |
Promise = require('bluebird'), | |
$ = require('jquery'); |
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
define(function () { | |
'use strict'; | |
var _ = require('underscore'); | |
var ValidationMixin = { | |
getInitialState: function () { | |
return { | |
errors: [] |
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
define(function () { | |
'use strict'; | |
var _ = require('underscore'); | |
var EDITABLE_STATE = 'editable', | |
SUBMITTING_STATE = 'submitting', | |
SUBMITTED_STATE = 'submitted'; |
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
'use strict'; | |
var Backbone = require('backbone'), | |
_ = require('underscore'); | |
/** | |
* A mixin for watching for Backbone models and collections | |
* Usage: | |
* | |
* var SomeComponent = React.createClass({ |
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 Popover = React.createClass({ | |
mixins: [ClassNameMixin], | |
className: 'Popover', | |
propTypes: { | |
anchorOffset: React.PropTypes.oneOf(['normal', 'fromRoundBtn', 'fromSmallRoundBtn']), | |
expandFrom: React.PropTypes.shape({ | |
horizontal: React.PropTypes.oneOf(['left', 'center', 'right']).isRequired, |
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
// Assumes you're using normalizr https://github.com/gaearon/normalizr | |
// --------------- | |
// Helpers: | |
// --------------- | |
// StoreUtils | |
'use strict'; |
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 Article = React.createClass({ | |
mixins: [createStoreMixin(ArticleStore)], | |
propTypes: { | |
articleId: PropTypes.number.isRequired | |
}, | |
getStateFromStores() { | |
return { | |
article: ArticleStore.get(this.props.articleId); |
OlderNewer