Skip to content

Instantly share code, notes, and snippets.

View eddsaura's full-sized avatar
Areté

Saura eddsaura

Areté
View GitHub Profile
@eddsaura
eddsaura / Graphql code gen Gist
Last active December 3, 2021 10:14
Installation of graphql-codegen
//Obviously before we need graphql
yarn add graphql
// Installation
yarn add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/introspection @graphql-codegen/typescript-react-apollo
// Initiate
yarn graphql-codegen init
// script
@eddsaura
eddsaura / parallaxMouse.js
Last active March 2, 2021 12:13
Parallax Mouse function with mouseMove for React
// The node with the mouseOver event has the background image we are moving
const calcParallax = e => {
const speed = -0.009
const distX = e.clientX / 2
const distY = e.clientY
e.currentTarget.style.backgroundPositionX = `calc(50% + ${(distX * speed)}px)`
e.currentTarget.style.backgroundPositionY = `calc(50% + ${(distY * speed)}px)`
}