View Dispatcher.js
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; |
View example.js
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/> | |
); | |
} | |
}); |
View User.js
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 |
View getRouteProps.js
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/>; |
View abortable-promise.js
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); | |
} | |
}); |
View partial-solution.js
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 } |
View AutoBindingComponent.js
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); | |
} |
View string.rb
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
require 'citrus' | |
Citrus.eval(<<'CODE') | |
grammar RubyString | |
rule string | |
single_quoted_string | double_quoted_string | |
end | |
# This should be expanded to account for escaped single quotes. | |
rule single_quoted_string |
View fixed-position.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
#wrapper { | |
width: 800px; | |
margin: 0 auto; | |
background: green; |
View days.rb
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
require 'citrus' | |
Citrus.eval(<<'CODE') | |
grammar Days | |
rule every_n_days | |
('every ' number ' days') { | |
"INTERVAL=#{number}" | |
} | |
end | |
OlderNewer