Skip to content

Instantly share code, notes, and snippets.

View brunos3d's full-sized avatar
:shipit:
hunting bytes 🏹

Bruno Silva brunos3d

:shipit:
hunting bytes 🏹
View GitHub Profile
// ==UserScript==
// @name JPG Store Optimizer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.jpg.store/collection/unwantedones*
// @icon https://www.google.com/s2/favicons?sz=64&domain=jpg.store
// @grant none
// ==/UserScript==
// ==UserScript==
// @name MacBook Chrome Optimizer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
@brunos3d
brunos3d / _error.tsx
Last active July 7, 2022 15:31
Next.js with Sentry (_error.tsx file)
import NextErrorComponent, { ErrorProps } from 'next/error';
import { captureException, flush } from '@sentry/nextjs';
import type { NextPage, NextPageContext } from 'next/types';
export interface AppErrorProps extends ErrorProps {
err?: Error;
hasGetInitialPropsRun?: boolean;
}
@brunos3d
brunos3d / nx-project-schema-vscode-intellisense.json
Last active July 13, 2022 18:41
How to use multiple schemas in one json file
{
"$ref": "file:../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/checkout",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
/*
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es6",
"lib": [
"es2019",
"dom",
@brunos3d
brunos3d / react-version.js
Created August 3, 2022 18:03
Inspect/Find the React version of a website
__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.forEach(r => console.log(`${r.rendererPackageName}: ${r.version}`))
import App, { AppProps, AppContext } from 'next/app';
function MyApp({ Component, pageProps }: AppProps) {
return (
<Component {...pageProps} />
);
}
MyApp.getInitialProps = async (context: AppContext) => {
return await App.getInitialProps(context); // Retrieves page's `getInitialProps`
import { ComponentProps, JSXElementConstructor } from 'react';
export const provider = <C extends JSXElementConstructor<unknown>>(
provider: C,
props: Partial<ComponentProps<C>> = {}
) => [provider, props];
export const ProviderComposer = ({ providers, children }) => {
for (let i = providers.length - 1; i >= 0; --i) {
const [Provider, props] = providers[i];
@brunos3d
brunos3d / consumed-mfe.d.ts
Created August 29, 2022 21:11
How to declare federated components types with typescript module declaration
declare module 'remoteA/componentA' {
function Component(props: unknown): JSX.Element;
export default Component;
}
declare module 'remoteB/componentB' {
export type ComponentProps = {
foo: boolean;
bar?: () => void;
};
@brunos3d
brunos3d / readme.md
Last active August 31, 2022 21:18
How to enable Nx template files (__tmpl__) syntax highlight for vscode

How to enable Nx template files (tmpl) syntax highlight for vscode

This gist demonstrate how to enable syntax highlight on vscode for nx template files.

The Nx template files uses EJS syntax

To enable the syntax hightlight for EJS just install this extension and add the config below to your vscode settings.json file

Addtionally you can add *__tmpl__ your .prettierignore file