To create a ReactComponent:
ReactComponent React.createClass(object proto)
Basic JSX example:
var TitleComponent = React.createClass({
// REQUIRED
| ### Full command line options | |
| ``` | |
| ffmpeg -f gif -i FOO.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' BAR.mp4 | |
| ``` | |
| ### Notie | |
| * output mp4 is encoded with h264, support Firefox/Chrome/Safari in Windows, Mac OSX, Android, and iOS. |
| // Observable is an Union Type, with the following variants | |
| const Empty = () => ['EMPTY'] | |
| const Cons = (head, tail) => ['CONS', head, tail] | |
| const Future = promise => ['FUTURE', promise] | |
| // race between 2 promises; each promise will resolve to a lazy value | |
| const lazyRace = (p1, p2) => Promise.race([p1,p2]).then(lazy => lazy()) | |
| // function composition | |
| const compose = (...fns) => (arg) => fns.reduceRight((res, f) => f(res), arg) |
| // array utils | |
| // ================================================================================================= | |
| const combine = (...arrays) => [].concat(...arrays); | |
| const compact = arr => arr.filter(Boolean); | |
| const contains = (() => Array.prototype.includes | |
| ? (arr, value) => arr.includes(value) | |
| : (arr, value) => arr.some(el => el === value) |
| 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. |
| # Node-WebKit CheatSheet | |
| # Download: https://github.com/rogerwang/node-webkit#downloads | |
| # Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions | |
| # Wiki: https://github.com/rogerwang/node-webkit/wiki | |
| # How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium | |
| # 1. Run your application. | |
| # https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps |
| var $ = require('NodObjC'); | |
| $.import('Cocoa'); | |
| var installNSBundleHook = function() { | |
| var cls = $.NSBundle; | |
| if (cls) { | |
| var bundleIdentifier = cls.getInstanceMethod('bundleIdentifier'); | |
| bundleIdentifier.setImplementation(function(val) { |
| (function() { | |
| // Do not use this library. This is just a fun example to prove a | |
| // point. | |
| var Bloop = window.Bloop = {}; | |
| var mountId = 0; | |
| function newMountId() { | |
| return mountId++; | |
| } |
| function onlyStatic (middleware) { | |
| return function (req, res, next) { | |
| var match = /(\.css|\.eot|\.gif|\.html|\.js|\.png|\.svg|\.ttf|\.woff|\.jpg)($|\?.*$)/ig.exec(req.originalUrl); | |
| if (!match) return next(); | |
| middleware(req, res, next); | |
| }; | |
| } | |
| //usage | |
| this.use(onlyStatic(express.static(__dirname + "/public"))); |
| /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HiServices.framework/Versions/A/Resources/cursors |