Skip to content

Instantly share code, notes, and snippets.

View reichert621's full-sized avatar

Alex Reichert reichert621

View GitHub Profile
@reichert621
reichert621 / keybase.md
Created December 19, 2016 18:37
Keybase proof

Keybase proof

I hereby claim:

  • I am reichert621 on github.
  • I am alexhaven (https://keybase.io/alexhaven) on keybase.
  • I have a public key whose fingerprint is 17B5 344A 2ABB A851 11D5 7700 776C 6210 F268 C1A7

To claim this, I am signing this object:

@reichert621
reichert621 / validations-2.js
Created September 9, 2018 05:11
Refactoring 2
const getValidators = () => {
return [
{
field: 'name',
validations: [
[isInputPresent, 'Name is required'],
[isValidName, 'Invalid name']
]
},
@reichert621
reichert621 / validations-0.js
Last active September 12, 2018 07:09
Refactoring #0
const handleValidations = inputs => {
const { name, email, birthday } = inputs;
const required = ['name', 'email', 'address', 'state', 'country', 'birthday'];
let errors = {};
for (let i = 0; i < required.length; i += 1) {
const val = required[i];
if (inputs[val].length < 1) {
@reichert621
reichert621 / app.js
Last active May 21, 2019 07:57
Upload files to Amazon S3 with loopback, loopback-component-storage, angular, ng-file-upload
// bower dependency: "ng-file-upload"
// npm dependency: "loopback-component-storage"
'use strict';
angular
.module('app', [
'ngFileUpload'
])
.controller('UploadController', function(Upload) {
import React from 'react';
import { StripeProvider, Elements, injectStripe } from 'react-stripe-elements';
// Replace with your public key (https://dashboard.stripe.com/test/apikeys)
const STRIPE_API_KEY = 'pk_test_xxx';
const Checkout = props => {
const handleCheckout = () => {
props.stripe.redirectToCheckout({
items: [{ sku: props.skuId, quantity: 1 }],
import request from 'superagent';
import React from 'react';
import StripeCheckout from 'react-stripe-checkout';
// Replace with your public key (https://dashboard.stripe.com/test/apikeys)
const STRIPE_API_KEY = 'pk_test_xxx';
const createOrder = (skuId, customer) => {
const { email, name, address } = customer;
const express = require('express');
const bodyParser = require('body-parser');
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
const createOrder = (skuId, { email, name, address }) => {
@reichert621
reichert621 / index.html
Created July 1, 2019 02:23
HTML with Stripe
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ... -->
<!-- Add this script tag within the <head> tags! -->
<script src="https://js.stripe.com/v3"></script>
</head>
<body>
// Load environment variables from our `.env` file
require('dotenv').config();
const path = require('path');
const express = require('express');
// Make sure your STRIPE_SECRET_KEY exists as an environment variable!
// This should look something like `sk_test_xxxxxxxxxxxxxxxxxxxxxxxxx`
// and can be found at https://dashboard.stripe.com/test/apikeys
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
// import ...
import './App.css'; // Import our new CSS
const STRIPE_API_KEY = 'pk_test_...';
const createCharge = token => {
// ...
};
const Form = props => {