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
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
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 Firebase = require('firebase'); | |
var baseRef = new Firebase('https://my-firebase.firebaseio.com'); | |
function getSnapshotValue(snapshot) { | |
return snapshot.val(); | |
} | |
/** | |
* A mixin for components that want to bind the value of a state variable | |
* to the value at a Firebase ref. |
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 d = require('d'); | |
var warning = require('react/lib/warning'); | |
var Promise = require('es6-promise').Promise; | |
function isNotNull(object) { | |
return object != null; | |
} | |
function Dispatcher() { | |
this._currentActionName = 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
var App = React.createClass({ | |
render: function () { | |
return ( | |
<this.props.activeRouteHandler/> | |
); | |
} | |
}); |
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 User = React.createClass({ | |
statics: { | |
willTransitionTo: function (transition, params, query) { | |
// possibly cancel the transition to a page | |
}, | |
willTransitionFrom: function (transition, component) { | |
// possibly cancel the transition away from a page |
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 App = React.createClass({ | |
statics: { | |
getRouteProps: function (params, query) { | |
return { | |
currentUser: getCurrentUser() | |
}; | |
} | |
}, | |
render: function () { | |
return <this.activeRouteHandler/>; |
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 promise = new AbortablePromise(function (resolve, reject, onAbort) { | |
// Use resolve & reject as you normally would. | |
var request = makeRequest( ... , function (error, response) { | |
if (error) { | |
reject(error); | |
} else { | |
resolve(response); | |
} | |
}); |
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 React = require('react'); | |
var escapeRegExp = require('./utils/escapeRegExp'); | |
var CATALOG = [ | |
{ | |
category: 'Sporting Goods', | |
products: [ | |
{ name: 'Basketball', price: 4000 }, | |
{ name: 'Boxing Gloves', price: 3500, inStock: true }, | |
{ name: 'Baseball', price: 1000 } |
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 React = require('react'); | |
class AutoBindingComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
for (var property in this) { | |
if (this.hasOwnProperty(property) && typeof this[property] === 'function') { | |
this[property] = this[property].bind(this); | |
} |
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
set guifont=Monaco:h14 | |
set background=dark | |
set transparency=3 | |
color base16-chalk |