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 React, { createContext, useContext, useEffect, useRef } from 'react' | |
import Head from 'next/head' | |
import Router from 'next/router' | |
const ScrollRestorationContext = createContext(null) | |
export const useScrollRestoration = ({ router, ignorePattern: optsIgnorePattern }) => { | |
const shouldScrollRestore = useRef(true) |
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 middy from '@middy/core' | |
import ssm from '@middy/ssm' | |
import { ApolloServer } from 'apollo-server-lambda' | |
import { makeExecutableSchema, mergeSchemas } from '@graphql-tools/schema' | |
import { | |
introspectSchema, | |
wrapSchema, | |
TransformObjectFields, | |
FieldNodeTransformer, | |
} from '@graphql-tools/wrap' |
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 { Handler } from 'aws-lambda' | |
import { ApolloServer } from 'apollo-server-lambda' | |
import { makeExecutableSchema, mergeSchemas } from '@graphql-tools/schema' | |
import { introspectSchema, wrapSchema } from '@graphql-tools/wrap' | |
import { AsyncExecutor } from '@graphql-tools/utils' | |
import { fetch } from 'cross-fetch' | |
import { printSchema, print } from 'graphql' | |
const { CONTENTFUL_CDA, CONTENTFUL_SPACE } = process.env |
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 * as sst from '@serverless-stack/resources' | |
import * as iam from '@aws-cdk/aws-iam' | |
import * as apigw from '@aws-cdk/aws-apigatewayv2' | |
export default class MyStack extends sst.Stack { | |
constructor(scope: sst.App, id: string, props?: sst.StackProps) { | |
super(scope, id, props) | |
const { account, region } = scope |
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 deployment1 = new s3deploy.BucketDeployment(this, 'BucketDeployment1', { | |
sources: [ | |
s3deploy.Source.asset(props.siteAssetsPath, { | |
ignoreMode: cdk.IgnoreMode.GIT, | |
exclude: ['*.*', '!*.js', '!*.css', 'sw.js', '!static/**', '_redirects'], | |
}), | |
], | |
memoryLimit: 512, | |
cacheControl: [s3deploy.CacheControl.fromString('public,max-age=31536000,immutable')], | |
destinationBucket: primaryBucket, |
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 reqHSContactByEmail = async (email, retryNum = 0) => { | |
expect(retryNum).to.be.lessThan(10) | |
return cy | |
.request({ | |
url: `${HUBSPOT_CONTACT_API(email)}?hapikey=${Cypress.env( | |
'HUBSPOT_API_KEY' | |
)}`, | |
failOnStatusCode: false, | |
}) | |
.then((resp) => { |
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: | |
- service: ozw.set_config_parameter | |
data: | |
node_id: 23 | |
parameter: 14 | |
value: Red | |
# To: | |
- service: zwave_js.set_config_parameter | |
target: |
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
# Place this file in the route of your S3 bucket | |
# https://www.npmjs.com/package/middy-reroute | |
# Redirect with 301 | |
/home / | |
/google https://www.google.com | |
# Redirect with 302 | |
/my-redirect / 302 | |
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 { useState, useEffect, useRef, useCallback } from 'react'; | |
import useThrottledOnScroll from './useThrottledOnScroll'; | |
const useScrollSpy = ({ items = [], target = window } = {}) => { | |
const itemsWithNodeRef = useRef([]); | |
useEffect(() => { | |
itemsWithNodeRef.current = getItemsClient(items); | |
}, [items]); | |
const [activeState, setActiveState] = useState(null); |
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
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
Lambda: | |
Type: AWS::Serverless::Function | |
Properties: | |
Runtime: nodejs8.10 | |
InlineCode: | | |
exports.handler = (event, ctx, cb) => { | |
console.log(JSON.stringify(event)); |
NewerOlder