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 lang=en> | |
| <head> | |
| <meta charset=utf-8> | |
| <title>Hello React!</title> | |
| </head> | |
| <body> | |
| <div id="root"></div> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script> |
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
| import mapValues from 'lodash/object/mapValues'; | |
| import every from 'lodash/collection/every'; | |
| const sortUsersByKey (users, key) => { | |
| //... | |
| }; | |
| const upperCaseNames (users) => { | |
| // ... | |
| }; |
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
| import {cond, eq, between, T} from 'ramda'; | |
| <div> | |
| {cond([ | |
| [eq(0), () => <span>sleepy</span>], | |
| [between(0, 20), () => <span>calm</span>], | |
| [between(20, 40), () => <span>angry</span>], | |
| [between(40, 41), () => <span>raging</span>], | |
| [T, () => <span>unknown anger level</span>] | |
| ], angerLevel)}; |
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
| // require() some stuff from npm (like you were using browserify) | |
| // and then hit Run Code to run it on the right | |
| var flyd = require('flyd'); | |
| var scanMerge = require('flyd-scanmerge'); | |
| var stream = flyd.stream(0); | |
| var createTodo = flyd.stream(); | |
| var deleteTodo = flyd.stream(); |
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
| async.it('waits to request to finish', function (done) { | |
| doRequest().then(function (data) { | |
| expect(data).toEqual('hello world'); | |
| done(); | |
| }) | |
| }); |
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
| define(['jquery'], function ($) { | |
| var fetchAndInitModule = function () { | |
| var node = $(this), | |
| module = node.data('module'); | |
| require([module], function (module) { | |
| module.init(node); | |
| }); | |
| }; |
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
| (function(exports) { | |
| var mod = function (databaseName, saveInterval) { | |
| var self; | |
| saveInterval = saveInterval || 2000; | |
| databaseName = databaseName || 'unnamed'; | |
| this.hasChanged = false; | |
| this.store = {}; |