Skip to content

Instantly share code, notes, and snippets.

export const validateEmailAndPassword = (validate, fields) => validate(fields)
.prop('email')
.required()
.email()
.prop('password')
.required()
.simplePassword()
.promise;
@steida
steida / HellowEste.react.js
Created July 5, 2016 01:07
Maybe it's time for the first Este abstraction.
// React from este creates stateless component with immutable props check.
import React, { title, fields } from 'este';
let HelloEste = ({ fields }) =>
<div>
Hello Este! Some text: {fields.text.value}
<input {...fields.text} />
</div>;
HelloEste = title(HelloEste, 'Hello Este!');
@steida
steida / index.js
Created July 2, 2016 17:27
Este React Native index with working Intl polyfill
// Bootstrap environment
require('react-native-browser-polyfill');
// global.Intl Polyfill
// Server polyfillLocales doesn't work anymore, because packager error:
// Encountered an error while persisting cache:
// > Error: TimeoutError: transforming /Users/este/dev/este/node_modules
// /intl/locale-data/complete.js took longer than 301 seconds.
// require('../server/intl/polyfillLocales')(
// self,
@steida
steida / HelloMessage.js
Created June 23, 2016 00:24
React stateless components with lifecycle proposal
const HelloMessage = props =>
<div>Hello {props.name}</div>;
{
let isMounted = false;
const focusAfterAfterOneSec = el => {
setTimeout(() => {
if (!isMounted) return;
el.focus();
import Component from 'react-pure-render/component';
import React, { PropTypes } from 'react';
import ValidationError from '../../common/lib/validation/ValidationError';
import { FormattedMessage, defineMessages } from 'react-intl';
const messages = defineMessages({
required: {
defaultMessage: `{prop, select,
description {Please enter a description.}
email {Please enter an email address.}
MonikaMoncekova@seznam.cz
ales.randl@volny.cz
amastalir@slezska.cz
asistent.SPCR@seznam.cz
asistent.jermar@seznam.cz
asistent@cabrnochova.eu
asistent@jstraka.cz
asistentka@eliskawagnerova.cz
asistentkadt@seznam.cz
bajert@senat.cz
@steida
steida / Dispatcher.js
Created May 18, 2016 00:04
The original Este Flux implementation. That's basically super simplified Redux :-)
export default class Dispatcher {
constructor(store) {
this.store = store;
this.state = store();
}
dispatch(action) {
this.state = this.store(this.state, action);
this.onChange && this.onChange(this.state);
}
load(state) {
react: 577.1 KB (25.5%)
<self>: 577.1 KB (100%)
core-js: 250.3 KB (11.0%)
<self>: 250.3 KB (100%)
bluebird: 168.6 KB (7.44%)
<self>: 168.6 KB (100%)
immutable: 139.14 KB (6.14%)
<self>: 139.14 KB (100%)
firebase: 137.95 KB (6.09%)
<self>: 137.95 KB (100%)
firebase
.child('vetos-votes/yes/vetos/EJixtowRe')
.orderByChild('createdAt')
.once('value', snapshot => {
snapshot.forEach(itemSnapshot => {
// forEach does not follow .orderByChild('createdAt')
console.log(itemSnapshot.val())
});
})
import React, { Component, PropTypes } from 'react';
export default class Html extends Component {
static propTypes = {
appCssFilename: PropTypes.string,
bodyHtml: PropTypes.string.isRequired,
googleAnalyticsId: PropTypes.string.isRequired,
helmet: PropTypes.object.isRequired,
isProduction: PropTypes.bool.isRequired