(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var AnimatableComponent = React.createClass({ | |
propTypes: { | |
tag: React.PropTypes.component.isRequired, |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
define(function(require) { | |
var React = require('react'); | |
var paramRegex = /__(\d)+/; | |
var parser = new DOMParser(); | |
var errorDoc = parser.parseFromString('INVALID', 'text/xml'); | |
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI; | |
// turns the array of string parts into a DOM | |
// throws if the result is an invalid XML document. |
/* | |
* twitter-entities.js | |
* This function converts a tweet with "entity" metadata | |
* from plain text to linkified HTML. | |
* | |
* See the documentation here: http://dev.twitter.com/pages/tweet_entities | |
* Basically, add ?include_entities=true to your timeline call | |
* | |
* Based off existing code from Wade Simmons | |
* Licensed under the MIT license |
/** @jsx React.DOM */ | |
var Graphic = React.createClass({ | |
componentDidMount: function() { | |
var context = this.getDOMNode().getContext('2d'); | |
this.paint(context); | |
}, | |
componentDidUpdate: function() { |
var React = require('react'); | |
var Immutable = require('immutable-with-cursors'); | |
var mainComponent = React.createClass({ | |
getInitialState: function() { | |
return this.props; | |
}, | |
render: function() { | |
return React.DOM.ul( | |
null, |
this.arrayInsert = function (array, index, other) { | |
for (var i = 0; i < other.length; ++i) { | |
array.splice(i + index, 0, other[i]) | |
} | |
return array | |
}; | |
this.createStyleSheet = function (doc, url) { | |
var style = this.createElement("link"); | |
style.setAttribute("charset", "utf-8"); | |
style.setAttribute("rel", "stylesheet"); |
var i, arr = [1, 2, 3, 4, 5, 6, 7, 8]; | |
for(i = 0; i < arr.length / 2; i++) { | |
var temp = arr[i]; | |
arr[i] = arr[arr.length - i - 1] | |
arr[arr.length - i - 1] = tmp | |
} | |
/* | |
passes: |
@MM.module 'KonamiApp', (KonamiApp, App, Backbone, Marionette, $, _) -> | |
# up, up, down, down, left, right, left, right, a, enter | |
KonamiApp.sequence = [38, 38, 40, 40, 37, 39, 37, 39, 65, 13] | |
KonamiApp.pressed = [] | |
KonamiApp.on | |
'start': -> | |
$(window).on 'keyup.konami', KonamiApp.pressedKey | |
'stop': -> | |
$(window).off '.konami' |