Skip to content

Instantly share code, notes, and snippets.

View thebigredgeek's full-sized avatar
💭
Considering new contract opportunities at this time

Andrew E. Rhyne thebigredgeek

💭
Considering new contract opportunities at this time
View GitHub Profile
@thebigredgeek
thebigredgeek / common.js
Created October 21, 2017 03:37
common class stuff in cs
import React, { PureComponent } from 'react';
import { autobind } from 'core-decorators';
export default class Button extends PureComponent {
@autobind
_handleOnClick (e) {
e.preventDefault();
console.log('I was clicked!');
}
render () {
@thebigredgeek
thebigredgeek / api.js
Created July 21, 2019 19:45
Overload Lead Gen API
const express = require('express');
const helmet = require('helmet');
const axios = require('axios');
const bodyParser = require('body-parser')
const client = axios.create({
baseURL: 'https://api.prosperworks.com/developer_api',
headers: {
'X-PW-AccessToken': process.env.COPPER_CRM_API_KEY,
'X-PW-Application': 'developer_api',
@thebigredgeek
thebigredgeek / app.js
Last active July 21, 2019 20:03
Overload Lead Generation App
import React, { useState, useRef } from 'react';
import { StyleSheet, View, KeyboardAvoidingView } from 'react-native';
import { Image, ThemeProvider, Input, Button } from 'react-native-elements';
import validator from 'validator'
import axios from 'axios'
import constants from './constants'
const { colors } = constants
@thebigredgeek
thebigredgeek / netlify.log
Created March 24, 2020 21:08
netlify failed deploy
3:57:02 PM: Build ready to start
3:57:04 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
3:57:04 PM: build-image tag: v3.3.7
3:57:04 PM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c
3:57:05 PM: Fetching cached dependencies
3:57:05 PM: Starting to download cache of 254.9KB
3:57:05 PM: Finished downloading cache in 164.787524ms
3:57:05 PM: Starting to extract cache
3:57:05 PM: Failed to fetch cache, continuing with build
3:57:05 PM: Starting to prepare the repo for build
@thebigredgeek
thebigredgeek / netlify.log
Created March 24, 2020 21:08
netlify failed deploy
3:57:02 PM: Build ready to start
3:57:04 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
3:57:04 PM: build-image tag: v3.3.7
3:57:04 PM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c
3:57:05 PM: Fetching cached dependencies
3:57:05 PM: Starting to download cache of 254.9KB
3:57:05 PM: Finished downloading cache in 164.787524ms
3:57:05 PM: Starting to extract cache
3:57:05 PM: Failed to fetch cache, continuing with build
3:57:05 PM: Starting to prepare the repo for build
@thebigredgeek
thebigredgeek / netlify.log
Created March 24, 2020 21:08
netlify failed deploy
3:57:02 PM: Build ready to start
3:57:04 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
3:57:04 PM: build-image tag: v3.3.7
3:57:04 PM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c
3:57:05 PM: Fetching cached dependencies
3:57:05 PM: Starting to download cache of 254.9KB
3:57:05 PM: Finished downloading cache in 164.787524ms
3:57:05 PM: Starting to extract cache
3:57:05 PM: Failed to fetch cache, continuing with build
3:57:05 PM: Starting to prepare the repo for build
@thebigredgeek
thebigredgeek / login.js
Last active May 19, 2020 19:48
JWT Login Example
const express = require('express')
, { json } = require('body-parser')
, jwt = require('jsonwebtoken')
, to = require('await-to-js')
, model = require('./model'); // fake model
// This only lives on the server, never the client!
const JWT_SECRET = process.env.JWT_SECRET;
// create a server instance
@thebigredgeek
thebigredgeek / endpoint.js
Last active May 18, 2020 18:52
JWT Protected Endpoint
const verifyJWT = async (req, res, next) => {
// Extract the authorization header
const header = req.get('Authorization');
// If no authorization header is present,
// send back an error
if (!header) {
res.status(401).send({
message: "Authorization required"
});
@thebigredgeek
thebigredgeek / example.js
Created May 19, 2020 20:16
JWT Tenant Secret Middleware
const model = require('./model'); // our fake model
const verifyJWT = async (req, res, next) => {
// Extract the authorization header
const header = req.get('Authorization');
let err
, secret
, id;
@thebigredgeek
thebigredgeek / middleware.js
Created September 9, 2020 18:09
Express req decoration
// ...
app.use((req, res, next) => {
req.foo = 'hello world';
next();
});