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
{ | |
// Config for VsCode Tailwind CSS IntelliSense extension for React | |
// Type hints for className and class attributes | |
"tailwindCSS.classAttributes": [ | |
"class", | |
"className", | |
], | |
// Type hints for variables and properties ending with *className | |
"tailwindCSS.experimental.classRegex": [ |
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 "../styles/globals.css"; | |
import type { AppProps } from "next/app"; | |
import useEvents from "../gtm/useEvents"; | |
import Tag from "../gtm/Tag"; | |
function MyApp({ Component, pageProps }: AppProps) { | |
useEvents(); | |
return ( | |
<> | |
<Tag /> |
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
export declare global { | |
interface Window { | |
dataLayer?: DataLayer.EventParameters[]; | |
} | |
} | |
declare namespace DataLayer { | |
interface EventParameters { | |
[key: string]: any; | |
} |
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 { useRouter } from "next/router"; | |
import { useEffect } from "react"; | |
const useEvents = () => { | |
const router = useRouter(); | |
useEffect(() => { | |
const onRouteChangeComplete = (url: string) => { | |
window.dataLayer?.push({ | |
event: "route_complete", | |
url, |
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 Script from "next/script"; | |
import { FC } from "react"; | |
// Your Google Tag Manager Container ID | |
const GTM_ID = "GTM-XXXXXXX"; | |
const Tag: FC = () => { | |
return ( | |
<> | |
<Script id="GTMDataLayer" strategy="afterInteractive"> |
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
{ | |
"React TypeScript Component": { | |
"prefix": ["comp"], | |
"body": "import { FC } from 'react'\n\ninterface Props {}\n\nconst ${1:Name}: FC<Props> = (props) => {\nreturn <div>$0</div>\n}\n\nexport default ${1:Name}" | |
} | |
} |
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
pushd "%~dp0" | |
dir /b %SystemRoot%\servicing\Packages\*containers*.mum >containers.txt | |
for /f %%i in ('findstr /i . containers.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" | |
del containers.txt | |
dism /online /enable-feature /featurename:Containers -All /LimitAccess /ALL | |
pause |
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
/** | |
* For full implementation with tests etc, see https://github.com/caki0915/arrayFlatten | |
* | |
* @param {Array} array The array to flatten. | |
* @param {number} depth The recursion depth. | |
* @param {Array} result Used for recursion. | |
* @returns {Array} Returns the new flattened array. | |
*/ | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
const arrayFlatten = (array: Array<any> = null, depth = 10, result: Array<any> = []): Array<any> => { |
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
// Component with renderProps that will add mouse position to the compoent that uses it. | |
class Mouse extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { mouseX: 0, mouseY: 0 }; | |
} | |
onMouseMove = e => { | |
this.setState({ mouseX: e.clientX, mouseY: e.clientY }); | |
}; | |
componentDidMount() { |
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
// Component with renderProps that will add mouse position to the compoent that uses it. | |
class Mouse extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { mouseX: 0, mouseY: 0 }; | |
} | |
onMouseMove = e => { | |
this.setState({ mouseX: e.clientX, mouseY: e.clientY }); | |
}; | |
componentDidMount() { |
NewerOlder