Skip to content

Instantly share code, notes, and snippets.

View mcshiz's full-sized avatar

Brian McCall mcshiz

  • United States
View GitHub Profile
@mcshiz
mcshiz / new-job.js
Created April 17, 2018 18:53
Answer
const request = require('request');
const Rx = require('rxjs');
const { expand } = require('rxjs/operators');
const { empty } = require('rxjs/observable/empty');
const URL = 'https://letsrevolutionizetesting.com/challenge';
let makeHttpCall = (url = URL) => {
return new Promise((resolve, reject) => {
request.get(url, {json: true}, (e, res, body) => {
if(e) {
@mcshiz
mcshiz / new-job.js
Last active April 17, 2018 18:52
Answer.js
const request = require('request');
const Rx = require('rxjs');
const { expand } = require('rxjs/operators');
const { empty } = require('rxjs/observable/empty');
const URL = 'https://letsrevolutionizetesting.com/challenge';
let makeHttpCall = (url = URL) => {
return new Promise((resolve, reject) => {
request.get(url, {json: true}, (e, res, body) => {
if(e) {
@mcshiz
mcshiz / readme.md
Created January 9, 2018 18:47
Helpful snippits

Starting express-generator server with nodemon add this to the servers package json "scripts": { "start": "PORT=3001 nodemon ./bin/www" }

Setting env variables for use with process.env.BLAH Use the dotenv package Create server root level .env file require('dotenv').config({path: '/custom/path/to/your/env/vars'}) variables now accessible under process.env.VARIABLE

@mcshiz
mcshiz / App.js
Created January 7, 2018 22:16
React Router v4 Private Route with Redux props
const PrivateRoute = ({component: Component, ...rest}) => {
return (
<Route
{...rest}
render={(props) => rest.authenticated === true
? <Component {...rest} {...props} />
: <Redirect to={{pathname: '/login', state: {from: props.location}}} />}
/>
)
};