Skip to content

Instantly share code, notes, and snippets.

Cory House coryhouse

Block or report user

Report or block coryhouse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coryhouse
coryhouse / package.json
Last active Dec 5, 2019
Example of calling one script from another
View package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack"
}
}
@coryhouse
coryhouse / package.json
Last active Dec 4, 2019
Example of pre and post scripts in package.json
View package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"prebuild": "echo I run before the build script",
"build": "cross-env NODE_ENV=production webpack",
"postbuild": "echo I run after the build script"
}
}
@coryhouse
coryhouse / package.json
Last active Dec 3, 2019
package.json for Building a JS Development Environment on Pluralsight
View package.json
{
"name": "javascript-development-environment",
"version": "1.0.0",
"description": "JavaScript development environment Pluralsight course by Cory House",
"scripts": {
},
"author": "Cory House",
"license": "MIT",
"dependencies": {
"whatwg-fetch": "1.0.0"
@coryhouse
coryhouse / install.sh
Last active Nov 27, 2019
Dependencies for React Auth0 on Pluralsight - Last Updated 11/30/2018
View install.sh
npm install auth0-js@9.8.0 auth0-lock@11.10.0 express@4.16.3 express-jwt@5.3.1 express-jwt-authz@1.0.0 jwks-rsa@1.3.0 npm-run-all@4.1.3 react-router-dom@4.3.1
@coryhouse
coryhouse / updates.md
Last active Sep 30, 2019
Building Apps with React Redux on Pluralsight - 2019 Course Updates
View updates.md

Enhancements and changes

  1. Upgraded to React 16.8, React Router 5, Babel 7, Webpack 4
  2. Hooks
  3. Optimistic delete example
  4. Middleware coverage
  5. Async/await coverage
  6. Using json-server instead of homemade mock API
  7. Centralized API proxy and utils
  8. Immer coverage
  9. Webpack-bundle-analyzer
@coryhouse
coryhouse / .eslintrc.json
Last active Sep 25, 2019
.eslintrc.json file for "Building a JavaScript Development" Pluralsight course
View .eslintrc.json
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
@coryhouse
coryhouse / webpack.config.dev.js
Last active Sep 24, 2019
Development Webpack config for "Building a JavaScript Development Environment" on Pluralsight
View webpack.config.dev.js
import path from 'path';
export default {
debug: true,
devtool: 'inline-source-map',
noInfo: false,
entry: [
path.resolve(__dirname, 'src/index')
],
target: 'web',
@coryhouse
coryhouse / async.js
Created Oct 15, 2017
Async/Await example
View async.js
getPosts().then(posts => {
console.log(posts.length);
});
async function getPosts() {
try {
const response = await fetch("https://jsonplaceholder.typicode.com/posts");
return response.json();
} catch(error) {
console.log(error);
@coryhouse
coryhouse / logic-less-jsx.jsx
Last active Aug 23, 2019
Note that the vars at the top keep the JSX simple. Other options here: https://verekia.com/react/logic-less-jsx/
View logic-less-jsx.jsx
// Logic-less JSX via vars above
const Animal = ({ id, name, legCount, isFriendly }) => {
const url = `url/animal/${id}`
const legCountStr = toString(legCount) || '?'
const friendliness = { true: 'Friendly', false: 'Unfriendly' }[isFriendly]
const hasNotEnoughData = legCount === undefined && isFriendly === undefined
return (
<li>
<a href={url}>{name}</a> - {legCountStr} legs
View Conditionals.jsx
str // strings
<Cmp /> // components
<Cmp {...{ a, b, }} /> // instead of a={a} b={b}. yes, it's less performant
foo && <Cmp /> // shows if truthy
foo === somevalue && <Cmp /> // shows if foo is somevalue
!foo && <Cmp /> // shows if falsy
foo !== somevalue && <Cmp /> // shows if foo is not somevalue
You can’t perform that action at this time.