This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styled from 'styled-components'; | |
import { media } from 'utils/mediaQuery'; | |
const Title = styled.h1` | |
font-size: 24px; | |
${media.medium` | |
font-size: 30px; | |
`} | |
${media.large` | |
font-size: 36px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { join, resolve, basename } = require('path'); | |
const { ensureDir, remove, readdir, copySync } = require('fs-extra'); | |
async function calculateDirs() { | |
const program = { | |
directory: join('/', 'opt', 'build', 'cache'), | |
}; | |
const dirsToCache = [resolve(program.directory, 'public'), resolve(program.directory, '.cache')]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
function Timer() { | |
const [time, setTime] = React.useState(0); | |
const [timerRunning, setTimerRunning] = React.useState(0); | |
const intervalRef = React.useRef(); | |
React.useEffect(() => { | |
if (timerRunning) { | |
intervalRef.current = setInterval(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { graphql, StaticQuery } from 'gatsby'; | |
function TestimonialQuery({ children, identifier }) { | |
return ( | |
<StaticQuery | |
query={graphql` | |
query { | |
allContentfulTestimonial { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {shallow} from 'enzyme'; | |
import Loading from './'; | |
describe('<Loading />', () => { | |
const notLoadingWrapper = shallow(<Loading loading={false} />); | |
const defaultWrapper = shallow(<Loading />); | |
it('renders without crashing', () => { | |
expect(defaultWrapper.find('View').length).not.toEqual(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by the movie 21. I wanted to run a simulation to better understand the | |
// problem and test to see if the odds really do shift to 66%. | |
// Spoiler Alert: They do! | |
// NOTE: Also swapped llamas for goats since they are way cooler | |
// Generate a random number between 1 and 3 | |
function getNum() { | |
return Math.floor(Math.random() * 3) + 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your Component (anywhere in your project) | |
// | |
// Place this fragment at the bottom of your component | |
// and Gatsby will collect it prior to running any | |
// page queries | |
export const profileImageFragment = graphql` | |
fragment ProfileImage on RootQueryType { | |
mattProfile: imageSharp(id: {regex: "/matt-profile.png/"}) { | |
resolutions(width: 339, height: 339) { | |
...GatsbyImageSharpResolutions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Router } from 'react-router-dom'; | |
import { Provider } from 'react-redux'; | |
import { applyMiddleware, compose, createStore } from 'redux'; | |
import thunk from 'redux-thunk'; | |
import rootReducer from './src/reducers'; | |
const loadDevTools = () => | |
process.env.NODE_ENV === 'development' && window.devToolsExtension | |
? window.__REDUX_DEVTOOLS_EXTENSION__ && |