Demo of multipart form/file uploading with hapi.js.
npm install
npm run setup
npm run server
Then ...
| function validateEmail(email) { | |
| var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| return re.test(email); | |
| } | |
| if (validateEmail(email)) | |
| console.log('valid'); | |
| else | |
| console.log('invalid'); |
| // Load plugins | |
| var gulp = require('gulp'), | |
| sass = require('gulp-ruby-sass'), | |
| autoprefixer = require('gulp-autoprefixer'), | |
| minifycss = require('gulp-minify-css'), | |
| rename = require('gulp-rename'), | |
| notify = require('gulp-notify'), | |
| concat = require('gulp-concat'), | |
| uglify = require('gulp-uglify'), | |
| markdown = require('gulp-markdown'), |
| 'use strict' | |
| const Joi = require('joi') | |
| const ObjectAssign = require('object-assign') | |
| const BaseModel = require('hapi-mongo-models').BaseModel | |
| const StatusEntry = require('./status-entry') | |
| const NoteEntry = require('./note-entry') | |
| const Account = BaseModel.extend({ | |
| constructor: function (attrs) { |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>Stripe Sample Form</title> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
| <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script> | |
| <script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
| <script type="text/javascript"> |
| #!/bin/sh | |
| if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ] | |
| then | |
| export PATH=/usr/local/bin:$PATH | |
| export NODE_ENV=production | |
| cd /path/to/app && forever --spinSleepTime 10000 start server.js >> forever.log 2>&1 | |
| fi |
react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);2) get requireAccess func => bindCheckAuth to redux
These are some things I've found helpful after doing React for a couple months. It's possible these practices are short sighted and will cause other problems, I just haven't hit those bumps in the road yet.
This list started after reading this phenomincal article on React Tips and Best Practicies.
Think of propTypes as a love letter to whatever developer will work on a component after you. Your components should be as declarative as possible. React's error messaging is so clear and helpful and this will make things so much easier.
| { 'extends': 'eslint-config-airbnb', | |
| 'env': { | |
| 'browser': true, | |
| 'node': true, | |
| 'mocha': true | |
| }, | |
| 'rules': { | |
| 'no-unused-vars': 0, | |
| 'no-debugger': 0, | |
| 'spaced-comment': [2, 'always'], |