This file contains 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
#!/bin/bash | |
#Starts forever after boot through /etc/rc.local. Set the node version in the following script properly. | |
/home/<user>/.nvm/versions/node/<node version>/bin/forever start /home/<user>/<path to prerender>/server.js |
This file contains 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
#!/bin/sh -e | |
sleep 2 | |
su - ubuntu -c /home/ubuntu/prerender_startup.sh | |
exit 0 |
This file contains 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
export default reduxForm({ | |
form: 'signIn', | |
validate: (values) => { | |
const errors = {}; | |
errors.email = !values.email | |
? 'Email field is required' | |
: !emailRegex.test(values.email) | |
? 'Email format is invalid' | |
: undefined; |
This file contains 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
<Field | |
name={'password'} | |
component={MyTextInput} | |
validate={[ | |
(val) => val ? undefined : 'Password field is required', | |
(val) => val && val.length >= 8 ? undefined : 'Password must be at least 8 characters long' | |
]} | |
/> |
This file contains 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
export default reduxForm({ | |
form: 'signIn', | |
asyncValidate: (values) => { | |
return new Promise((resolve, reject) => { | |
// simulate request | |
setTimeout(() => { | |
if (values.email.indexOf('@wolox.com') === -1) { | |
reject({ email: 'Only mails at wolox are allowed' }); | |
} else { | |
resolve(); |
This file contains 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 React from 'react'; | |
import { TextInput, View, Text } from 'react-native'; | |
/** | |
* to be wrapped with redux-form Field component | |
*/ | |
export default function MyTextInput(props) { | |
const { input, meta, ...inputProps } = props; | |
const formStates = ['active', 'autofilled', 'asyncValidating', 'dirty', 'invalid', 'pristine', |
This file contains 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 React from 'react'; | |
import { reduxForm, Field } from 'redux-form'; | |
import { ScrollView, Text } from 'react-native'; | |
import MyTextInput from './MyTextInput'; | |
function MyForm() { | |
return ( | |
<ScrollView keyboardShouldPersistTaps={'handled'}> | |
<Text>Email</Text> |
This file contains 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 React from 'react'; | |
import { TextInput, View, Text } from 'react-native'; | |
/** | |
* to be wrapped with redux-form Field component | |
*/ | |
export default function MyTextInput(props) { | |
const { input, ...inputProps } = props; | |
return ( |
This file contains 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> | |
<meta charset=utf-8 /> | |
<title>videojs-contrib-hls embed</title> | |
<!-- | |
Uses the latest versions of video.js and videojs-contrib-hls. |
This file contains 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
server { | |
listen 80; | |
root /home/yourusername/www/mysite; | |
location / { | |
try_files $uri @prerender; | |
} | |
location @prerender { |