In OOP we have mixed instance data and class functions:
class Animal {
constructor(name) {
this.name = name;
}
speak() {| var Index = React.createClass({ | |
| getInitialState: function () { | |
| return { | |
| lastPress: 0 | |
| } | |
| }, | |
| onPress: function () { | |
| var delta = new Date().getTime() - this.state.lastPress; |
| // This example shows the difference | |
| // between classNames, classNames/bind and classnames-loader | |
| // submit-button.css | |
| /* | |
| :local .className { | |
| color: green; | |
| background: red; | |
| } |
| # StackOverflow: http://stackoverflow.com/questions/21215059/cant-use-nvm-from-root-or-sudo | |
| # Source: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps | |
| # The below command seems to fix the problem | |
| n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local | |
| # The above command is a bit complicated, but all it's doing is copying whatever version of node | |
| # you have active via nvm into the /usr/local/ directory (where user installed global files should | |
| # live on a linux VPS) and setting the permissions so that all users can access them. |
| { | |
| "ru": { | |
| "Your original english text": "Твой оригинальный русский текст" | |
| } | |
| } |
| /** | |
| * @providesModule PatientList | |
| */ | |
| import NavigationBar from 'react-native-navbar'; | |
| import NavigationButtons from 'NavigationButtons'; | |
| import React, { ListView, Navigator, StyleSheet, Text, TextInput, TouchableHighlight, View } from 'react-native'; | |
| import { connect } from 'react-redux/native' | |
| @connect(state => ({ | |
| patients: state.patients |
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
| export default function renderRoute(request, reply) { | |
| const store = configureStore(); | |
| store.dispatch(match(request.path, (error, redirectLocation, routerState) => { | |
| if (redirectLocation) { | |
| reply.redirect(redirectLocation.pathname + redirectLocation.search); | |
| } else if (error) { | |
| reply(error.message).code(500); | |
| } else if (!routerState) { | |
| reply('Not found').code(404); | |
| } else { |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| // give it a name so it reuses the same window | |
| var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no"); | |
| // reload in case it's reusing the same window with the old content | |
| win.location.reload(); | |
| // wait a little bit for it to reload, then render | |
| setTimeout(function() { | |
| React.render( | |
| <DebugPanel top right bottom left > |