Skip to content

Instantly share code, notes, and snippets.

@DZuz14
DZuz14 / pitchers.js
Created April 27, 2019 20:20
ESPN MLB Pitcher Duplicates
1.) Grab each pitcher from table and their stats.
- Store them in object like:
```
{
'C. Sale': [5,2,3],
'H. Martinez': [20,9,4],
'R. Martinez': [3,7,1],
'J. Schmoe': [20,25,99],
'R. Kelly': [20,9,4],
'P. Kelly': [3,7,1],
{
"away": {
"stats": {
"Junis": [
"5.0",
"4",
"1",
"1",
"2",
"6",
@DZuz14
DZuz14 / user-profile.js
Last active August 22, 2019 08:04
User Profile Form, No Action Creator.
import React, { Component } from 'react';
import { submitProfileForm } from '../actions/profile-form';
export default class ProfileForm extends Component {
handleSubmit = e => {
e.preventDefault();
// Emit the action here!!!
};
render() {
@DZuz14
DZuz14 / user-profile.js
Created August 22, 2019 08:20
User Profile Form With Action Creator
import React, { Component } from 'react';
import { submitProfileForm } from '../actions/profile-form';
export default class ProfileForm extends Component {
handleSubmit = e => {
e.preventDefault();
submitProfileForm();
};
render() {
@DZuz14
DZuz14 / user-profile.js
Created August 22, 2019 08:36
User Profile Reducer
const initialState = {
submitting: false,
success: '',
error: '',
};
/**
* @function userProfile
*/
const userProfile = (state = initialState, action) => {
@DZuz14
DZuz14 / readme.md
Last active January 19, 2020 17:40
Gatsby Config Suggestions

Gatsby Config Suggestions

Here are the following errors I receive on my Windows 10 machine using gatsby ^2.18.12. At the bottom of the file, I've included the specs of my computer for reference. I decided to remove stack trace info, as it really doesn't matter at the moment.

Top Level Keys

If a top level key is misspelled or a an invalid key is added.

  • Change "plugins" to "plugin".
@DZuz14
DZuz14 / data.json
Last active March 26, 2020 17:35
Thumbnail Gallery Fix
{
"thumbnails": [
{
"imgUrl": "https://images.unsplash.com/photo-1531366936337-7c912a4589a7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1200&q=80",
"title": "Aurora Borealis",
"bodyText": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
},
{
"imgUrl": "https://images.unsplash.com/photo-1505689151358-52c00af435e5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1200&q=80",
"title": "Vast Canyon",
@DZuz14
DZuz14 / Slider.js
Created February 8, 2020 19:39
Slider with React Hooks 1
import React, { useState } from 'react'
/**
* @function Slider
*/
const Slider = () => {
return <div>{/* */}</div>
}
export default Slider
@DZuz14
DZuz14 / Slider.js
Last active February 8, 2020 23:56
Slider With React Hooks (2)
/** @jsx jsx */
import React, { useState } from 'react'
import { css, jsx } from '@emotion/core'
/**
* @function Slider
*/
const Slider = () => {
return <div css={SliderCSS}>{/* */}</div>
}
@DZuz14
DZuz14 / SliderContent.js
Created February 8, 2020 20:53
Slider with React Hooks 3
import React from 'react'
import styled from '@emotion/styled'
const SliderContent = styled.div`
transform: translateX(-${props => props.translate}px);
transition: transform ease-out ${props => props.transition}s;
height: 100%;
width: ${props => props.width}px;
display: flex;
`