This file contains hidden or 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
| ;; juxt from clojure, takes a list of functions and then applies each to a list of inputs | |
| (define (juxt . fns) | |
| (λ args | |
| (map (λ (fn) (apply fn args)) fns))) |
This file contains hidden or 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 React = require('react'); | |
| var TestUtils = require('react/lib/ReactTestUtils'); | |
| var GameOfLife = require('../../src/components/game-of-life'); | |
| describe('game of life', function () { | |
| it('renders without problems', function () { | |
| var gameOfLife = TestUtils.renderIntoDocument(<GameOfLife/>); | |
| var mainDiv = TestUtils.findRenderedDOMComponentWithClass(gameOfLife, 'main').getDOMNode(); |
This file contains hidden or 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 context = require.context('./tests/components', true, /-test\.js$/); | |
| context.keys().forEach(context); |
This file contains hidden or 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 Game = (function (module) { | |
| //...some code here | |
| return module.exports = function (size) { | |
| init(size); | |
| return { | |
| grid: grid, |
This file contains hidden or 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'), | |
| GameOfLife = require('./components/game-of-life'); | |
| React.render( | |
| <GameOfLife />, | |
| document.getElementById('content') | |
| ); |
This file contains hidden or 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'), | |
| Game = require("../game/game.js"); | |
| var GameOfLife = React.createClass({displayName: 'GameOfLife', | |
| render: function() { | |
| return ( | |
| <div className="main"> | |
| Game of Life. | |
| </div> | |
| ); |
This file contains hidden or 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> | |
| <title>Conway's game of life with ReactJS</title> | |
| <link rel="stylesheet" href="/styles/style.css"> | |
| </head> | |
| <body> | |
| <div id="content"></div> | |
| <script src="/assets/bundle.js"></script> | |
| </body> |
This file contains hidden or 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
| //... | |
| "scripts": { | |
| "start": "node server.js" | |
| }, | |
| //... |
This file contains hidden or 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 webpack = require('webpack'); | |
| var WebpackDevServer = require('webpack-dev-server'); | |
| var config = require('./webpack.config'); | |
| new WebpackDevServer(webpack(config), { | |
| publicPath: config.output.publicPath, | |
| hot: true, | |
| historyApiFallback: true | |
| }).listen(3000, 'localhost', function (err, result) { | |
| if (err) { |
This file contains hidden or 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 webpack = require('webpack'); | |
| module.exports = { | |
| context: __dirname + "/src", | |
| entry: { | |
| app: ['webpack-dev-server/client?http://localhost:3000', | |
| 'webpack/hot/only-dev-server', | |
| './index.js' | |
| ] | |
| }, |
NewerOlder