This file contains 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 { useMediaQuery } from 'usehooks-ts' | |
import { useMemo } from 'react'; | |
import { screens } from '.generated/screens'; | |
/* | |
// You can also define the screens object manually if you don't want to use a prebuilt script. | |
const screens = { | |
sm: '640px', | |
md: '768px', |
This file contains 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 buildLambda from 'netlify-lambda/lib/build'; | |
export default async function({ service: { commands, projectOptions } }) { | |
const { build, serve } = commands; | |
const buildFn = build.fn; | |
const serveFn = serve.fn; | |
build.fn = async (...args) => { | |
try { | |
const res = await buildFn(...args); |
This file contains 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 { ApolloLink } from 'apollo-link'; | |
import { HttpLink } from 'apollo-link-http'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
export default ctx => { | |
const httpLink = new HttpLink({ | |
uri: process.env.PROJECT_GRAPHQL_SERVER, | |
}); | |
const cache = new InMemoryCache(); |
This file contains 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
<template> | |
<form> | |
<p> | |
<label> | |
Your Name: <input type="text" name="name" v-model="form.name" /> | |
</label> | |
</p> | |
<p> | |
<label> | |
Your Email: <input type="email" name="email" v-model="form.email" /> |
This file contains 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
FROM node:10-alpine | |
# Create app directory | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Install app dependencies | |
COPY package.json /usr/src/app/ | |
COPY yarn.lock /usr/src/app/ | |
RUN yarn install |
This file contains 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
(() => { | |
let lastTime = 0; | |
const vendors = ['ms', 'moz', 'webkit', 'o']; | |
for (let x = 0; x < vendors.length && !window.requestAnimationFrame; x += 1) { | |
window.requestAnimationFrame = window[`${vendors[x]}RequestAnimationFrame`]; | |
window.cancelAnimationFrame = | |
window[`${vendors[x]}CancelAnimationFrame`] || | |
window[`${vendors[x]}CancelRequestAnimationFrame`]; | |
} |
This file contains 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 testAction = (action, payload, state, expectedMutations, done) => { | |
let count = 0; | |
// mock commit | |
const commit = (type, payload) => { | |
const mutation = expectedMutations[count]; | |
try { | |
expect(mutation.type).toEqual(type); | |
if (payload) { |
This file contains 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 axios from 'axios'; | |
import axiosCookieJarSupport from '@3846masa/axios-cookiejar-support'; | |
import tough from 'tough-cookie'; | |
import FormData from 'form-data'; | |
// Add cookie support for axios | |
axiosCookieJarSupport(axios); | |
class Uploaded { | |
constructor(options) { |
This file contains 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
export class GraphModel { | |
/** | |
* @param {Object} attrs Attributes on the GraphModel. | |
*/ | |
constructor(attrs) { | |
Object.defineProperty(this, 'attrs', { value: attrs, enumerable: false }); | |
Object.keys(this.attrs).filter(key => !(key in this)).forEach(key => { | |
let descriptor; | |
if (attrs[key] === null) { | |
descriptor = { |
This file contains 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 whitelist = ['chrome', 'crios', 'firefox', 'fxios', 'googlebot']; | |
const isSupportedBrowser = uas => { | |
if (uas && Array.isArray(uas) && uas.length > 0) { | |
return uas.some(ua => | |
whitelist.some(w => ua.value.toLowerCase().includes(w)) | |
); | |
} | |
return false; | |
}; |
NewerOlder