Skip to content

Instantly share code, notes, and snippets.

View parkerproject's full-sized avatar

Parker parkerproject

View GitHub Profile
@parkerproject
parkerproject / EmailValidator.js
Last active September 14, 2015 21:32
Email validation
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');
@parkerproject
parkerproject / README.md
Created October 13, 2015 17:05 — forked from joyrexus/README.md
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

@parkerproject
parkerproject / gist:2066e4e4216378790ee4
Created January 28, 2016 19:21 — forked from scottnix/gist:10430003
Gulpfile.js Sample, latest
// 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) {
@parkerproject
parkerproject / gist:0c9221ba3b89198a540a
Created March 28, 2016 16:54 — forked from boucher/gist:1750368
Stripe sample checkout form
<!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">
@parkerproject
parkerproject / starter.sh
Created April 19, 2016 20:46 — forked from danro/starter.sh
nodejs forever crontab reboot script
#!/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
@parkerproject
parkerproject / README.md
Created May 17, 2016 15:37 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)

Reduce boilerplate in Redux

  • Create actions similar to Flummox.
  • Generate action ids.
  • Supports actions with decorators, promises, and therefore ES7 async.
@parkerproject
parkerproject / Learning.markdown
Created May 30, 2016 00:44 — forked from mattmcmanus/Learning.markdown
React Best Practices - Lessons learned after a couple months of using React

React Best Practices - Lessons learned after a couple months of using React

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.

1. Always define your propTypes. Always.

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.

@parkerproject
parkerproject / eslintrc
Created July 15, 2016 15:07
config for eslint
{ 'extends': 'eslint-config-airbnb',
'env': {
'browser': true,
'node': true,
'mocha': true
},
'rules': {
'no-unused-vars': 0,
'no-debugger': 0,
'spaced-comment': [2, 'always'],